Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/264929
Change subject: Notify translators about the availability of personalized suggestions ...................................................................... Notify translators about the availability of personalized suggestions This notification is sent atmost once to any translator. Currently configured to sent when the translator publish their second article. Bug: T119939 Change-Id: I76ef9d1c2214b7d6af083dac2d3f0473260f4a98 --- M ContentTranslation.hooks.php M api/ApiContentTranslationPublish.php M i18n/en.json M i18n/qqq.json M includes/EchoNotificationPresentationModel.php M includes/Notification.php 6 files changed, 31 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/29/264929/1 diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php index 9711584..1a98b6d 100644 --- a/ContentTranslation.hooks.php +++ b/ContentTranslation.hooks.php @@ -298,6 +298,14 @@ 'email-subject-message' => 'cx-notification-hundredth-translation-email-subject', ); + $notifications['cx-suggestions-available'] = array( + 'category' => 'cx', + 'group' => 'positive', + 'presentation-model' => 'ContentTranslation\\EchoNotificationPresentationModel', + 'title-message' => 'cx-notification-suggestions-available', + 'email-subject-message' => 'cx-notification-suggestions-available-email-subject', + ); + $icons['cx'] = array( 'path' => 'ContentTranslation/images/cx-notification-green.svg', ); @@ -315,6 +323,7 @@ case 'cx-first-translation': case 'cx-tenth-translation': case 'cx-hundredth-translation': + case 'cx-suggestions-available': $extra = $event->getExtra(); if ( !isset( $extra['recipient'] ) ) { break; diff --git a/api/ApiContentTranslationPublish.php b/api/ApiContentTranslationPublish.php index 8bbf1f8..66e4856 100755 --- a/api/ApiContentTranslationPublish.php +++ b/api/ApiContentTranslationPublish.php @@ -289,6 +289,9 @@ case 1: ContentTranslation\Notification::firstTranslation( $user ); break; + case 2: + ContentTranslation\Notification::suggestionsAvailable( $user ); + break; case 10: ContentTranslation\Notification::tenthTranslation( $user ); break; diff --git a/i18n/en.json b/i18n/en.json index 5ba3d9b..18c144b 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -202,5 +202,7 @@ "cx-draft-restore-failed": "Failed to load the saved translation!", "cx-suggestionlist-expand": "View all", "cx-suggestionlist-collapse": "View less", - "cx-suggestionlist-refresh": "Refresh suggestions" + "cx-suggestionlist-refresh": "Refresh suggestions", + "cx-notification-suggestions-available": "Based on your previous translations, we have new articles to suggest to translate. Please visit the [[Special:ContentTranslation#suggestions|Content translation dashboard]].", + "cx-notification-suggestions-available-email-subject": "Suggestions available" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 7f5480f..d2d9cc3 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -208,5 +208,7 @@ "cx-draft-restore-failed": "Message indicating that the fetching of saved translation failed.", "cx-suggestionlist-expand": "Label for the suggestions list expand trigger\n{{Identical|View all}}", "cx-suggestionlist-collapse": "Label for the suggestions list collapse trigger", - "cx-suggestionlist-refresh": "Label for the suggestions list refresh trigger" + "cx-suggestionlist-refresh": "Label for the suggestions list refresh trigger", + "cx-notification-suggestions-available": "Echo notification to inform the translator about the availability of personalized suggestions", + "cx-notification-suggestions-available-email-subject": "Email subject to inform the translator about the availability of personalized suggestions" } diff --git a/includes/EchoNotificationPresentationModel.php b/includes/EchoNotificationPresentationModel.php index 1c33fa2..997da2e 100644 --- a/includes/EchoNotificationPresentationModel.php +++ b/includes/EchoNotificationPresentationModel.php @@ -27,6 +27,7 @@ 'cx-first-translation' => 'cx-notification-first-translation', 'cx-tenth-translation' => 'cx-notification-tenth-translation', 'cx-hundredth-translation' => 'cx-notification-hundredth-translation', + 'cx-suggestions-available' => 'cx-notification-suggestions-available' ); return $map[ $this->type ]; } diff --git a/includes/Notification.php b/includes/Notification.php index e0d4e7c..25ba056 100644 --- a/includes/Notification.php +++ b/includes/Notification.php @@ -42,4 +42,16 @@ ) ) ); } + + /** + * Notify the user about the availability of personalized suggestions. + */ + public static function suggestionsAvailable( \User $recipient ) { + \EchoEvent::create( array( + 'type' => 'cx-suggestions-available', + 'extra' => array( + 'recipient' => $recipient->getId(), + ) + ) ); + } } -- To view, visit https://gerrit.wikimedia.org/r/264929 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I76ef9d1c2214b7d6af083dac2d3f0473260f4a98 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits