Skip to content

Commit

Permalink
db-tabulator: fix subscriptions state when pages are moved or deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Jan 22, 2024
1 parent f05936a commit 9b5e2bf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions db-tabulator/eventstream-metadata-maintainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class DbTabulatorMetadata extends Route {
filter(data: RecentChangeStreamEvent): boolean {
return data.wiki === 'enwiki' &&
((data.type === 'categorize' && data.title === 'Category:' + SUBSCRIPTIONS_CATEGORY) ||
((data.type === 'edit' || (data.type === 'log' && (data.log_type === 'move' || data.log_type === 'delete')))
((data.type === 'edit' || (data.type === 'log' && (data.log_action === 'move' || data.log_action === 'delete')))
&& this.subscriptions.has(data.title) && data.user !== BOT_NAME));
}

Expand All @@ -64,10 +64,18 @@ export default class DbTabulatorMetadata extends Route {
this.subscriptions.delete(page.title);
}
this.updateMetadata(page.title);
} else if (data.log_type === 'move') {

} else if (data.log_action === 'move') {
this.updateMetadata(data.title);
this.subscriptions.delete(data.title);
this.updateMetadata(data.log_params.target);
} else { // edits, deletions
this.subscriptions.add(data.log_params.target);

} else if (data.log_action === 'delete') {
this.updateMetadata(data.title);
this.subscriptions.delete(data.title);

} else { // edit
this.updateMetadata(data.title);
}
}
Expand Down

0 comments on commit 9b5e2bf

Please sign in to comment.