The titles for showing suggestions are in CX database. We query them for a user, source language, target language and list in CX dashboard. But the titles might be already present in target language - created using CX or any other article creation methods. CX Source selector and CX translation editor has checks and warnings about 'already existing title', so this check is not going to be missed. But even then showing an existing article as suggestion won't be good.
Following is the proposed strategy to keep our suggestion database updated
- SuggestionListManager will have a public method to delete a title from cx_suggestions for the given source language, target language, source title.
- APIContentTranslationSuggestion to be written to delete a suggestion, create a suggestion list, add to a suggestion list
- ApiQueryContentTranslationSuggestions will do a check whether any suggestions is in progress or in published stage and filter them out from suggestions. This can be part of getRelevantSuggestions method - while querying check if cx_translations table has entry for the translation. ApiQueryContentTranslationSuggestions will not update suggestion database. The translation might get deleted in while in progress and we dont want a valid suggestion get disappeard from suggestion database.
- In CX Dashboard, when suggestions are recieved, before displaying each one to user, use action=query&prop=langlinks api to check if the article is created somehow in target language. Don't list those titles, but collect them. Pass those titles to APIContentTranslationSuggestion to delete. So, as long as people visiting the suggestion tab, the suggestion database get updated 24X7.
- APIContentTranslationPublish will delete the suggestion item from database after a translation is published.