From 9b5e2bf75b77e8f09f6008fbbbbbd906bbf6bdfe Mon Sep 17 00:00:00 2001 From: Siddharth VP Date: Mon, 22 Jan 2024 23:25:16 +0530 Subject: [PATCH] db-tabulator: fix subscriptions state when pages are moved or deleted --- db-tabulator/eventstream-metadata-maintainer.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/db-tabulator/eventstream-metadata-maintainer.ts b/db-tabulator/eventstream-metadata-maintainer.ts index 0125dca..258aca0 100644 --- a/db-tabulator/eventstream-metadata-maintainer.ts +++ b/db-tabulator/eventstream-metadata-maintainer.ts @@ -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)); } @@ -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); } }