Page MenuHomePhabricator

Add Hook for PageTriage after specific actions taken, to allow access from gadgets
Open, Needs TriagePublic3 Story Points

Description

As followup for T207237: Page Curation Tools to add userspace CSD Log/PROD Log functionality, we could add a hook that fires on PageTriage's actions (deletion/mark as reviewed/unreview/etc) that allows external tools, gadgets and extensions to respond to PageTriage actions in a consolidated way.

As an example, Twinkle can utilize this hook to add the information to their CSD logs. Another example is potentially creating a tool to batch logs, respond to certain types of actions and alert users. These are tools that are not prioritized and are out of scope for the current work, but the adding of this hook will enable these powerful utilizations for extending PageTriage work.

Event Timeline

ifried created this task.Aug 13 2019, 10:37 PM
Restricted Application added a project: Growth-Team. · View Herald TranscriptAug 13 2019, 10:37 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
ifried set the point value for this task to 3.Aug 13 2019, 10:37 PM
Mooeypoo renamed this task from Placeholder: Add Hook for T207237 [more info added later] to Placeholder: Add Hook for PageTriage after specific actions taken, to allow access from gadgets.Aug 14 2019, 10:01 PM
Mooeypoo renamed this task from Placeholder: Add Hook for PageTriage after specific actions taken, to allow access from gadgets to Add Hook for PageTriage after specific actions taken, to allow access from gadgets.
Mooeypoo updated the task description. (Show Details)
kostajh moved this task from Inbox to Triaged but Future on the Growth-Team board.Aug 16 2019, 3:02 PM
kostajh added a subscriber: kostajh.

Seems like a good idea, but not something that Growth-Team will be able to work on anytime soon.

Change 530977 had a related patch set uploaded (by MusikAnimal; owner: MusikAnimal):
[mediawiki/extensions/PageTriage@master] Add JS hooks so that other scripts/gadgets can integrate with PageTriage

https://gerrit.wikimedia.org/r/530977

MusikAnimal removed MusikAnimal as the assignee of this task.Tue, Sep 3, 9:23 PM
MusikAnimal added a subscriber: MusikAnimal.

One of the biggest issues here is that we call the hook just before we refresh the page, and that the use cases that this hook is for are working asynchronously, which means refreshing immediately after call is not going to help anything

After conversation with the team, here's the new plan:

  • Create an mw.hook that fires when PageTriage JavaScript finishes loading. That hook should provide an entrypoint for an array that expects promises. We can provide some expected parameters into the expected promises, like the action taken, data, etc.
  • Store the array of promises.
  • Before we refresh the page on the actions that were requested, we call all promises (can use a $.when on the stored array) and only after they're all resolved or rejected, we refresh the page.

This will allow other gadgets to hook into PageTrage while still allowing for async responses before the page is refreshed.

MusikAnimal removed MusikAnimal as the assignee of this task.Thu, Sep 5, 8:38 PM

Change 534942 had a related patch set uploaded (by Mooeypoo; owner: Mooeypoo):
[mediawiki/extensions/PageTriage@master] WIP: Add an asynchronous ActionQueue for external tools

https://gerrit.wikimedia.org/r/534942

Mooeypoo claimed this task.Sun, Sep 8, 7:26 AM

Change 534942 merged by jenkins-bot:
[mediawiki/extensions/PageTriage@master] Add an asynchronous ActionQueue for external tools

https://gerrit.wikimedia.org/r/534942

The new ActionQueue system was merged (many thanks Moriel!), so I will now make use of that in https://gerrit.wikimedia.org/r/530977

Change 535935 had a related patch set uploaded (by Mooeypoo; owner: Mooeypoo):
[mediawiki/extensions/PageTriage@master] ActionQueue: Allow for invoking multiple actions

https://gerrit.wikimedia.org/r/535935

Change 535935 merged by jenkins-bot:
[mediawiki/extensions/PageTriage@master] ActionQueue: Allow for invoking multiple actions

https://gerrit.wikimedia.org/r/535935