Add Link/Diagram: Fetching and completing link recommendation tasks

From Wikitech

Compatible with https://sequencediagram.org

title Link recommendation service (task fetch and completion)

actor User

User->SpecialHomepage:Navigate to Special:Homepage, suggested edits module loads

SpecialHomepage<-ElasticSearch:list of tasks filtered by type/topic fetched from ElasticSearch backend. Tasks with "hasrecommendation:link" included in the query.

SpecialHomepage->Article:User clicks on an article of "link-recommendation" type 

Article<-BeforePageDisplayHook:Hook runs on server-side

BeforePageDisplayHook<-Database:get JSON link recommendation data from growthexperiments_link_recommendations cache table

LinkRecommendationVisualEditorPlugin<-Article:VisualEditor link recommendation plugin loads with server-side exported JSON data for link recommendations

LinkRecommendationVisualEditorPlugin->AddLinkSubmissionHandler:User interacts with link recommendation suggestions, and saves the article with link recommendations accepted/rejected/skipped

AddLinkSubmissionHandler->Database:Link recommendations saved to growthexperiments_link_submissions, normal edit save also occurs with additional change tags added

AddLinkSubmissionHandler->CachePurge:Article is removed from the task queue cache in growthexperiments_link_recommendations table

AddLinkSubmissionHandler->ElasticSearch: Search index is updated to remove "hasrecommendation:link" flag for the article.