r106078 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106077‎ | r106078 | r106079 >
Date:20:17, 13 December 2011
Author:bsitu
Status:ok
Tags:
Comment:
followup to r105969 - removed ?> from php files and updated response email with latest copy
Modified paths:
  • /trunk/extensions/MoodBar/ApiFeedbackDashboardResponse.php (modified) (history)
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/include/MoodBarHTMLEmailNotification.php (modified) (history)
  • /trunk/extensions/MoodBar/include/MoodBarHTMLMailerJob.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/include/MoodBarHTMLMailerJob.php
@@ -20,12 +20,10 @@
2121 $editor,
2222 $this->title,
2323 $this->params['timestamp'],
24 - $this->params['feedbackResponse'],
 24+ $this->params['feedback'],
2525 $this->params['response']
2626 );
2727 return true;
2828 }
2929
3030 }
31 -
32 -?>
Index: trunk/extensions/MoodBar/include/MoodBarHTMLEmailNotification.php
@@ -7,7 +7,7 @@
88 class MoodBarHTMLEmailNotification {
99
1010 protected $to, $subject, $body, $replyto, $from;
11 - protected $timestamp, $composed_common, $feedbackResponse, $response;
 11+ protected $timestamp, $composed_common, $response, $feedback;
1212 protected $mime_boundary;
1313
1414 /**
@@ -34,10 +34,10 @@
3535 * @param $editor User object
3636 * @param $title Title object
3737 * @param $timestamp string Edit timestamp
38 - * @param $feedbackResponse integer response id
3938 * @param $response string response text
 39+ * @param $feedback integer feedback id
4040 */
41 - public function notifyOnRespond( $editor, $title, $timestamp, $feedbackResponse, $response ) {
 41+ public function notifyOnRespond( $editor, $title, $timestamp, $feedback, $response ) {
4242 global $wgEnotifUseJobQ, $wgEnotifUserTalk;
4343
4444 if ( $title->getNamespace() != NS_USER_TALK || !$wgEnotifUserTalk ||
@@ -51,12 +51,12 @@
5252 'editorID' => $editor->getID(),
5353 'timestamp' => $timestamp,
5454 'response' => $response,
55 - 'feedbackResponse' => $feedbackResponse
 55+ 'feedback' => $feedback
5656 );
5757 $job = new MoodBarHTMLMailerJob( $title, $params );
5858 $job->insert();
5959 } else {
60 - $this->actuallyNotifyOnRespond( $editor, $title, $timestamp, $feedbackResponse, $response );
 60+ $this->actuallyNotifyOnRespond( $editor, $title, $timestamp, $feedback, $response );
6161 }
6262 }
6363
@@ -69,10 +69,10 @@
7070 * @param $editor User object
7171 * @param $title Title object
7272 * @param $timestamp string Edit timestamp
73 - * @param $feedbackResponse integer response id
7473 * @param $response string response text
 74+ * @param $feedabck integer feedback id
7575 */
76 - public function actuallyNotifyOnRespond( $editor, $title, $timestamp, $feedbackResponse, $response ) {
 76+ public function actuallyNotifyOnRespond( $editor, $title, $timestamp, $feedback, $response ) {
7777
7878 global $wgEnotifUserTalk;
7979
@@ -86,8 +86,8 @@
8787 $this->timestamp = $timestamp;
8888 $this->editor = $editor;
8989 $this->composed_common = false;
90 - $this->feedbackResponse = $feedbackResponse;
9190 $this->response = $response;
 91+ $this->feedback = $feedback;
9292
9393 if ( $wgEnotifUserTalk && $this->canSendUserTalkEmail( $editor, $title ) ) {
9494 $this->compose( $this->targetUser );
@@ -145,48 +145,51 @@
146146 $pageEditor = $wgEnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName();
147147 }
148148
149 - $talkPageUrl = $this->title->getCanonicalURL() . '#feedback-dashboard-response-' . $this->feedbackResponse;
 149+ $feedbackUrl = SpecialPage::getTitleFor( 'FeedbackDashboard', $this->feedback )->getCanonicalURL();
150150
151151 // build the subject
152 - $this->subject = wfMessage( 'moodbar-enotif-subject')->params($pageEditor)->escaped();
 152+ $this->subject = wfMessage( 'moodbar-enotif-subject')->params( $pageEditor )->escaped();
153153
154 - // build section for the email body
155 - $textUserResponseMessage = wfMessage('moodbar-enotif-text-body-user-response-message')
156 - ->params($this->editor->getName(), $talkPageUrl)->escaped();
157 -
158 - $htmlUserResponseMessage = wfMsgExt('moodbar-enotif-html-body-user-response-message',
159 - array('parse'),
160 - $this->editor->getUserPage()->getCanonicalURL(),
161 - $this->editor->getName(),
162 - $talkPageUrl);
163 -
164 - $userReplyTitle = wfMessage('moodbar-enotif-body-user-response-title')->escaped();
165 -
166 -
 154+ // build the header
 155+ $textEmailHeader = wfMessage( 'moodbar-enotif-text-body-header' )
 156+ ->params( $pageEditor, $feedbackUrl )->escaped();
 157+ $htmlEmailHeader = wfMsgExt( 'moodbar-enotif-html-body-header',
 158+ array( 'parse' ),
 159+ $this->editor->getTalkPage()->getCanonicalURL(),
 160+ $pageEditor,
 161+ $feedbackUrl );
 162+ // build the response text
167163 $textResponse = htmlspecialchars( $this->response );
168 -
169164 $messageCache = MessageCache::singleton();
170165 $htmlResponse = $messageCache->parse( $this->response )->getText();
171166
 167+ //build the copy text
 168+ $textEmailCopy = wfMessage( 'moodbar-enotif-body-copy-text' )->escaped();
 169+ $htmlEmailCopy = wfMsgExt( 'moodbar-enotif-body-copy-text', array( 'parse' ) );
 170+
172171 //assemable the email body
173172 $this->body = <<<HTML
174173 --$this->mime_boundary
175174 Content-Type: text/plain; charset=UTF-8
176175 Content-Transfer-Encoding: 8bit
177176
178 -$textUserResponseMessage
179 -$userReplyTitle
 177+$textEmailHeader
 178+
180179 $textResponse
181180
 181+$textEmailCopy
 182+
182183 --$this->mime_boundary
183184 Content-Type: text/html; charset=UTF-8
184185 Content-Transfer-Encoding: 8bit
185186
186187 <html>
187188 <body>
188 - $htmlUserResponseMessage
189 - $userReplyTitle
 189+ $htmlEmailHeader
 190+
190191 $htmlResponse
 192+
 193+ $htmlEmailCopy
191194 </body>
192195 </html>
193196
@@ -234,5 +237,3 @@
235238 }
236239
237240 }
238 -
239 -?>
Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -161,9 +161,13 @@
162162 'response-ajax-error-body' => 'There was an error adding your response. <br />Please try again later.',
163163 //Email notification
164164 'moodbar-enotif-subject' => '$1 replied to your feedback',
165 - 'moodbar-enotif-text-body-user-response-message' => '$1 replied to your feedback, see the response: $2',
166 - 'moodbar-enotif-html-body-user-response-message' => '[$1 $2] replied to your feedback, see the [$3 response] for more detail',
167 - 'moodbar-enotif-body-user-response-title' => 'User response:'
 165+ 'moodbar-enotif-text-body-header' => '$1 responded to your feedback: $2',
 166+ 'moodbar-enotif-html-body-header' => '[$1 $2] responded to your [$3 feedback]',
 167+ 'moodbar-enotif-body-copy-text' => 'View this message on your talk page
 168+
 169+What is a talk page?
 170+
 171+Your talk page is where other Wikipedia editors communicate with you by leaving messages. Wikipedia editors use talk pages to discuss issues, provide help, notify people of what’s happening in the community, express thanks. They also use talk pages just to say hi.'
168172 );
169173
170174 /** Message documentation (Message documentation)
@@ -298,8 +302,9 @@
299303 'response-ajax-error-head' => 'Text for ajax status heading on error',
300304 'response-ajax-error-body' => 'Text for ajax status body on error (can be html)',
301305 'moodbar-enotif-subject' => 'Feedback response email subject',
302 - 'moodbar-enotif-text-body-user-response-message' => 'The text version response message, $1 is the user name, $2 is the link to the response',
303 - 'moodbar-enotif-html-body-user-response-message' => 'The html version response message, $1 is the the user page link, $2 is user name, $3 is the link to response',
 306+ 'moodbar-enotif-text-body-header' => 'The text version email header, $1 is the user name, $2 is the link to the feedback',
 307+ 'moodbar-enotif-html-body-header' => 'The html version email header, $1 is the the user talk page link, $2 is user name, $3 is the link to feedback',
 308+ 'moodbar-enotif-body-copy-text' => 'Email copy text'
304309 );
305310
306311 /** Afrikaans (Afrikaans)
Index: trunk/extensions/MoodBar/ApiFeedbackDashboardResponse.php
@@ -65,7 +65,7 @@
6666 global $wgLang;
6767
6868 $EMailNotif = new MoodBarHTMLEmailNotification();
69 - $EMailNotif->notifyOnRespond( $wgUser, $talkPage, wfTimestampNow(), $item->getProperty( 'id' ), $wgLang->truncate( $response, 250 ) );
 69+ $EMailNotif->notifyOnRespond( $wgUser, $talkPage, wfTimestampNow(), $item->getProperty('feedback'), $wgLang->truncate( $response, 250 ) );
7070
7171 }
7272
@@ -160,5 +160,3 @@
161161 }
162162
163163 }
164 -
165 -?>

Follow-up revisions

RevisionCommit summaryAuthorDate
r106106followup to -r106078 - Fix the language file for emailbsitu21:46, 13 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105969Add HTML email notification support for Moodbar Feedback Responsebsitu01:56, 13 December 2011

Status & tagging log