Robert Vogel has submitted this change and it was merged. Change subject: Review: Notifications ......................................................................
Review: Notifications * Re-Added i18n keys that got lost to "imporvements" * Fixed qqq for existing mail i18n-keys * Stoped using sendNotification method - keys will not be generated now * Marked Review::sendNotification as deprecated * Added TODO for echo notifications * Used ->text() instead of ->plain() for mail messages * Removed old params for lost keys * Used GENDER destinction in de, de-formal, en * prevented review finished mail from being sent when review is not finished Change-Id: I0ce9f270021013eb233e7105ca2513ba14f1a568 --- M Review/Review.class.php M Review/i18n/de-formal.json M Review/i18n/de.json M Review/i18n/en.json M Review/i18n/qqq.json 5 files changed, 143 insertions(+), 28 deletions(-) Approvals: Robert Vogel: Verified; Looks good to me, approved Tweichart: Checked; Looks good to me, but someone else must approve Raimond Spekking: Looks good to me, but someone else must approve diff --git a/Review/Review.class.php b/Review/Review.class.php index 20f29a6..3b5880c 100644 --- a/Review/Review.class.php +++ b/Review/Review.class.php @@ -341,7 +341,8 @@ /** * Wrapper method for the process of sending notification mails - * + * DEPRECATED - Use own functionallity instead! + * @deprecated since version 2.23.1 * @param string $sType a key which identifies the messages keys for the mail (accept, decline etc) * @param User $oReceiver the user object of the user which should get the notification * @param array $aParams additional parameters for the message @@ -350,6 +351,7 @@ */ public static function sendNotification($sType, $oReceiver, $aParams = array(), $sRelatedLink = null, $oInvolvedUser = null) { global $wgSitename; + wfDeprecated( __METHOD__, '2.23.1' ); // save the basic message key for this mail $sBaseMessageKey = "bs-review-mail-" . strtolower($sType); @@ -1036,8 +1038,6 @@ } $oReview = BsExtensionManager::getExtension('Review'); - $sTitleText = $oTitle->getPrefixedText(); - $sLink = BsLinkProvider::makeLink( $oTitle, $oTitle->getFullURL() ); $oNext = null; $dbw = wfGetDB(DB_MASTER); @@ -1096,7 +1096,6 @@ // Identify owner $oReviewProcess = BsReviewProcess::newFromPid($iArticleId); $oOwner = User::newFromID($oReviewProcess->getOwner()); - $sOwnerMail = $oOwner->getEmail(); $sUserName = BsCore::getUserDisplayName($oUser); $sOwnerName = BsCore::getUserDisplayName($oOwner); @@ -1120,18 +1119,67 @@ $oTitle->invalidateCache(); + if( $sVote == 'no' && $oReviewProcess->isSequential() ) { + $oReviewProcess->reset( $sComment ); + } + + //PW(09.03.2015): Echo notifications + //Notify the owner of the revie, that a user did some action + // if the receiver deactivated mail notifications, we stop right here + if (!BsConfig::getVarForUser('MW::Review::EmailNotifyReviewer', $oOwner->getName())) { + // Unfortunately, there is no way of verifying the result :( + return wfMessage('bs-review-review-saved')->plain(); + } + + $aParams = array( + BsCore::getUserDisplayName( $oUser ), + $oUser->getName(), + $oTitle->getPrefixedText(), + ); + if ($sVote == 'yes') { - self::sendNotification('accept', $oOwner, array($sTitleText, date('Y-m-d')), $sLink, $oUser); + $sSubject = wfMessage( "bs-review-mail-accept-header", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + $sMessage = wfMessage( "bs-review-mail-accept-body", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; } elseif ($sVote == 'no') { if ($oReviewProcess->isSequential()) { - $oReviewProcess->reset($sComment); - self::sendNotification('deny-and-restart', $oOwner, array($sTitleText, date('Y-m-d')), $sLink, $oUser); + $sSubject = wfMessage( "bs-review-mail-deny-and-restart-header", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + $sMessage = wfMessage( "bs-review-mail-deny-and-restart-body", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; } else { - self::sendNotification('deny', $oOwner, array($sTitleText, date('Y-m-d')), $sLink, $oUser); + $sSubject = wfMessage( "bs-review-mail-deny-header", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + $sMessage = wfMessage( "bs-review-mail-deny-body", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; } } + $sMessage .= wfMessage( 'bs-review-mail-link-to-page', $oTitle->getFullURL() ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + + BsMailer::getInstance('MW')->send( $oOwner, $sSubject, $sMessage ); + wfRunHooks('BsReview::getVoteResponseOnMailAction', array($row, $oTitle, $oOwner)); + + if( $oReviewProcess->isFinished() === false ) { + return wfMessage('bs-review-review-saved')->plain(); + } // Let flagged revision know that it's all goooooood (or not approved) $bResult = true; @@ -1139,16 +1187,44 @@ if ($bResult) { if ($oReviewProcess->isFinished() == 'status') { if (!$oUser->isAllowed('review')) { - self::sendNotification('finish', $oOwner, array($sTitleText), $sLink); + $sSubject = wfMessage( "bs-review-mail-finish-header", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + $sMessage = wfMessage( "bs-review-mail-finish-body", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; } else { - self::sendNotification('finish-and-review', $oOwner, array($sTitleText), $sLink); + $sSubject = wfMessage( "bs-review-mail-finish-and-review-header", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + $sMessage = wfMessage( "bs-review-mail-finish-and-review-body", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; } } } else { - if ($sOwnerMail) { - self::sendNotification('finish-no-flagged-revs', $oOwner, array($sTitleText), $sLink); - } + //This is probably handled somewhere else + //return wfMessage('bs-review-review-saved')->plain(); + $sSubject = wfMessage( "bs-review-mail-finish-header", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + $sMessage = wfMessage( "bs-review-mail-finish-body", $aParams ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; } + + $sMessage .= wfMessage( 'bs-review-mail-link-to-page', $oTitle->getFullURL() ) + ->inLanguage( $oOwner->getOption('language') ) + ->text() + ; + + BsMailer::getInstance('MW')->send( $oOwner, $sSubject, $sMessage ); // Unfortunately, there is no way of verifying the result :( return wfMessage('bs-review-review-saved')->plain(); @@ -1210,7 +1286,7 @@ // Identify owner $oOwner = User::newFromId( $oReviewProcess->getOwner() ); - $sOwnerName = $this->mCore->getUserDisplayName( $oOwner ); + $sOwnerRealName = BsCore::getUserDisplayName( $oOwner ); $oTitle = Title::newFromID( $oReviewProcess->pid ); $sTitleText = $oTitle->getPrefixedText(); @@ -1229,25 +1305,29 @@ } // Identify reviewer + //PW(10.03.2015): Echo notifications $sReviewerMail = $oReviewer->getEmail(); if ( !$sReviewerMail ) continue; $sReviewerLang = $oReviewer->getOption('language'); - $sSubject = wfMessage( - 'bs-review-mail-invite-header', $sTitleText - )->inLanguage( $sReviewerLang )->plain(); + $sSubject = wfMessage( 'bs-review-mail-invite-header', $sTitleText ) + ->inLanguage( $sReviewerLang ) + ->text() + ; - $sMsg = wfMessage( - 'bs-review-mail-invite-body', $sOwnerName, $oOwner->getName(), $sTitleText - )->inLanguage( $sReviewerLang )->plain(); + $sMsg = wfMessage( 'bs-review-mail-invite-body', $sOwnerRealName, $oOwner->getName(), $sTitleText ) + ->inLanguage( $sReviewerLang ) + ->text() + ; $sMsg .= "\n\n" . $sLink; if ($aReviewer['comment']) { - $sMsg .= "\n". wfMessage( - 'bs-review-mail-comment', $aReviewer['comment'] - )->inLanguage( $sReviewerLang )->plain(); + $sMsg .= "\n". wfMessage( 'bs-review-mail-comment', $aReviewer['comment'] ) + ->inLanguage( $sReviewerLang ) + ->text() + ; } //Send mail to next user in queue diff --git a/Review/i18n/de-formal.json b/Review/i18n/de-formal.json index 994850a..ded5d9d 100644 --- a/Review/i18n/de-formal.json +++ b/Review/i18n/de-formal.json @@ -7,10 +7,15 @@ "bs-review-save-nosteps": "Sie haben keine Schritte eingetragen.", "bs-review-save-norights": "Sie haben nicht die erforderliche Berechtigung.", "bs-review-review-secondtime": "Die Begutachtung konnte nicht gefunden werden. Möglicherweise versuchen Sie, diese Seite zum zweiten Mal zu begutachten", - "bs-review-mail-link-to-page": "Folgenden Sie diesem Link: $1", + "bs-review-mail-link-to-page": "Folgen Sie diesem Link: $1", "bs-review-mail-invite-header": "Bitte begutachten Sie diese Seite \"$1\"", - "bs-review-mail-invite-body": "$1 bittet Sie, den Artikel $2 zu begutachten.", - "bs-review-mail-comment": "Es wurde ein Kommentar für Sie eingetragen: \"$1\"", + "bs-review-mail-invite-body": "$1 {{GENDER:$2|bittet}} Sie, die Seite „$3“ zu begutachten.", + "bs-review-mail-comment": "Es wurde ein Kommentar für Sie eingetragen: \"$1\".", + "bs-review-mail-accept-body": "der Benutzer $1 hat auf Ihre Begutachtungsanfrage {{GENDER:$2|reagiert}} und den Änderungen {{GENDER:$2|zugestimmt}}.", + "bs-review-mail-deny-body": "der Benutzer $1 hat auf Ihre Begutachtungsanfrage {{GENDER:$2|reagiert}} und die Änderungen {{GENDER:$2|abgelehnt}}.", + "bs-review-mail-deny-and-restart-body": "der Benutzer $1 hat auf Ihre Begutachtungsanfrage {{GENDER:$2|reagiert}} und die Änderungen {{GENDER:$2|abgelehnt}}. Die Begutachtung wird automatisch neu gestartet.", + "bs-review-mail-finish-body": "der Benutzer $1 hat auf Ihre Begutachtungsanfrage für \"$3\" {{GENDER:$2|reagiert}} und den Änderungen {{GENDER:$2|zugestimmt}}. Die Begutachtung ist damit abgeschloßen.\n\n", + "bs-review-mail-finish-and-review-body": "der Benutzer $1 hat auf Ihre Begutachtungsanfrage für \"$3\" {{GENDER:$2|reagiert}} und den Änderungen {{GENDER:$2|zugestimmt}}. Die Begutachtung ist damit abgeschloßen und der Artikel wurde als \"geprüft\" markiert.\n\n", "bs-review-statebar-body-do-review": "Bitte begutachten Sie diese Seite", "bs-review-commentinputlabel": "Ihr Kommentar:", "bs-review-confirm-delete-step": "Möchten Sie diesen Schritt wirklich löschen?", diff --git a/Review/i18n/de.json b/Review/i18n/de.json index 3fcb099..9a1fb82 100644 --- a/Review/i18n/de.json +++ b/Review/i18n/de.json @@ -32,6 +32,16 @@ "bs-review-mail-invite-header": "Bitte begutachte diese Seite \"$1\"", "bs-review-mail-invite-body": "$1 {{GENDER:$2|bittet}} dich, die Seite „$3“ zu begutachten.", "bs-review-mail-comment": "Es wurde ein Kommentar für Dich eingetragen: \"$1\".", + "bs-review-mail-accept-header": "$1 hat dem Artikel $3 {{GENDER:$2|zugestimmt}}", + "bs-review-mail-accept-body": "der Benutzer $1 hat auf Deine Begutachtungsanfrage {{GENDER:$2|reagiert}} und den Änderungen {{GENDER:$2|zugestimmt}}.", + "bs-review-mail-deny-header": "$1 hat den Artikel $3 {{GENDER:$2|abgelehnt}}", + "bs-review-mail-deny-body": "der Benutzer $1 hat auf Deine Begutachtungsanfrage {{GENDER:$2|reagiert}} und die Änderungen {{GENDER:$2|abgelehnt}}.", + "bs-review-mail-deny-and-restart-header": "$1 hat den Artikel $3 {{GENDER:$2|abgelehnt}}", + "bs-review-mail-deny-and-restart-body": "der Benutzer $1 hat auf Deine Begutachtungsanfrage {{GENDER:$2|reagiert}} und die Änderungen {{GENDER:$2|abgelehnt}}. Die Begutachtung wird automatisch neu gestartet.", + "bs-review-mail-finish-header": "Begutachtung abgeschlossen", + "bs-review-mail-finish-body": "der Benutzer $1 hat auf Deine Begutachtungsanfrage für \"$3\" {{GENDER:$2|reagiert}} und den Änderungen {{GENDER:$2|zugestimmt}}. Die Begutachtung ist damit abgeschloßen.\n\n", + "bs-review-mail-finish-and-review-header": "Begutachtung abgeschlossen", + "bs-review-mail-finish-and-review-body": "der Benutzer $1 hat auf Deine Begutachtungsanfrage für \"$3\" {{GENDER:$2|reagiert}} und den Änderungen {{GENDER:$2|zugestimmt}}. Die Begutachtung ist damit abgeschloßen und der Artikel wurde als \"geprüft\" markiert.\n\n", "bs-review-statebar-body-do-review": "Bitte begutachte diese Seite", "bs-review-i-agree": "Ich stimme zu", "bs-review-i-dismiss": "Ich lehne ab", diff --git a/Review/i18n/en.json b/Review/i18n/en.json index 4631e0b..e601fe8 100644 --- a/Review/i18n/en.json +++ b/Review/i18n/en.json @@ -30,6 +30,16 @@ "bs-review-mail-invite-header": "Please review the page \"$1\"", "bs-review-mail-invite-body": "$1 has {{GENDER:$2|invited}} you to review the page \"$3\".", "bs-review-mail-comment": "A comment was entered: \"$1\".", + "bs-review-mail-accept-header": "$1 has {{GENDER:$2|accepted}} $3", + "bs-review-mail-accept-body": "the user $1 has {{GENDER:$2|reacted}} to your review and {{GENDER:$2|accepted}} the changes.", + "bs-review-mail-deny-header": "$1 has {{GENDER:$2|rejected}} $3", + "bs-review-mail-deny-body": "the user $1 has {{GENDER:$2|reacted}} to your review and {{GENDER:$2|rejected}} the changes.", + "bs-review-mail-deny-and-restart-header": "$1 has {{GENDER:$2|rejected}} $3", + "bs-review-mail-deny-and-restart-body": "the user $1 has {{GENDER:$2|reacted}} to your review and {{GENDER:$2|rejected}} the changes. The review will be restarted automatically.", + "bs-review-mail-finish-header": "Review finished", + "bs-review-mail-finish-body": "the user $1 has {{GENDER:$2|reacted}} to your review on \"$3\" and {{GENDER:$2|accepted}} the changes. The review is now finished.\n\n", + "bs-review-mail-finish-and-review-header": "$1 Review finished", + "bs-review-mail-finish-and-review-body": "the user $1 has {{GENDER:$2|reacted}} to your review on \"$3\" and {{GENDER:$2|accepted}} the changes. The review is now finished and got marked as stable.\n\n", "bs-review-statebar-body-do-review": "Please review this page", "bs-review-i-agree": "Agree", "bs-review-i-dismiss": "Disagree", diff --git a/Review/i18n/qqq.json b/Review/i18n/qqq.json index c13278c..b893228 100644 --- a/Review/i18n/qqq.json +++ b/Review/i18n/qqq.json @@ -33,9 +33,19 @@ "bs-review-review-secondtime": "Error message that a review could not be found. A possible reason is that the user tries to vote again", "bs-review-review-saved": "Success message that the the vote of a user was saved.", "bs-review-mail-link-to-page": "Text message that a user should follow this link.\n$1 is the link", - "bs-review-mail-invite-header": "Mail subject that a user should review a page\n$1 is the name of page which should be reviewed", - "bs-review-mail-invite-body": "Mail body that another user invited you to make a review of a page.\n*$1 is the real name of the which invited you \n*$2 is the username of the which invited you \n*$3 is the name of page which should be reviewed", + "bs-review-mail-invite-header": "Mail subject that a user should review a page.\n* $1 is the name of page which should be reviewed\n", + "bs-review-mail-invite-body": "Mail body that another user invited someone, to make a review of a page.\n* $1 is the real name of the user who invited)\n* $2 is the name of the user who invited - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", "bs-review-mail-comment": "Optional mail body that a comment was entered.\n* $1 is the comment.", + "bs-review-mail-accept-header": "Mail subject that a user has accepted.\n* $1 is the real name of the user, who accepted\n* $2 is the name of the user, who accepted - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-accept-body": "Mail body that a user has accepted.\n* $1 is the real name of the user, who accepted\n* $2 is the name of the user, who accepted - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-deny-header": "Mail subject that a user has denied.\n* $1 is the real name of the user, who denied\n* $2 is the name of the user, who denied - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-deny-body": "Mail body that a user has denied.\n* $1 is the real name of the user, who denied\n* $2 is the name of the user, who denied - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-deny-and-restart-header": "Mail subject that a user denied and the review will be restarted.\n* $1 is the real name of the user, who denied\n* $2 is the name of the user, who denied - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-deny-and-restart-body": "Mail body that a user denied and the review will be restarted.\n* $1 is the real name of the user, who denied\n* $2 is the name of the user, who denied - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-finish-header": "Mail subject that the review was finished.\n* $1 is the real name of the user, who accepted\n* $2 is the name of the user, who accepted - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-finish-body": "Mail body that the review was finished.\n* $1 is the real name of the user, who accepted\n* $2 is the name of the user, who accepted - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-finish-and-review-header": "Mail subject that the review was finished and was marked as stable\n* $1 is the real name of the user, who accepted\n* $2 is the name of the user, who accepted - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", + "bs-review-mail-finish-and-review-body": "Mail body that the review was finished and was marked as stable\n* $1 is the real name of the user, who accepted\n* $2 is the name of the user, who accepted - Use GENDER destinction\n* $3 is the name of page which should be reviewed\n", "bs-review-statebar-body-do-review": "Headline for the review section inside the state bar.", "bs-review-i-agree": "Button label that you agree you reviewed this page\n{{Identical|Agree}}", "bs-review-i-dismiss": "Button label that you disagree you reviewed this page\n{{Identical|Disagree}}", -- To view, visit https://gerrit.wikimedia.org/r/194328 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0ce9f270021013eb233e7105ca2513ba14f1a568 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions Gerrit-Branch: master Gerrit-Owner: Pwirth <wi...@hallowelt.biz> Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz> Gerrit-Reviewer: Pigpen <reym...@hallowelt.biz> Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz> Gerrit-Reviewer: Raimond Spekking <raimond.spekk...@gmail.com> Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: Tweichart <weich...@hallowelt.biz> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits