r106223 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106222‎ | r106223 | r106224 >
Date:18:50, 14 December 2011
Author:bsitu
Status:resolved (Comments)
Tags:
Comment:
follow up -r 105969 - update feedback response email with latest copy
Modified paths:
  • /trunk/extensions/MoodBar/MoodBar.i18n.php (modified) (history)
  • /trunk/extensions/MoodBar/include/MoodBarHTMLEmailNotification.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/include/MoodBarHTMLEmailNotification.php
@@ -145,56 +145,48 @@
146146 $pageEditor = $wgEnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName();
147147 }
148148
149 - $feedbackUrl = SpecialPage::getTitleFor( 'FeedbackDashboard', $this->feedback )->getCanonicalURL();
150 -
151149 // build the subject
152150 $this->subject = wfMessage( 'moodbar-enotif-subject')->params( $pageEditor )->escaped();
153151
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
163 - $textResponse = htmlspecialchars( $this->response );
164 - $messageCache = MessageCache::singleton();
 152+ // build the body
 153+ $messageCache = MessageCache::singleton();
 154+ $targetUserName = $this->targetUser->getName();
 155+ $FeedbackUrl = SpecialPage::getTitleFor( 'FeedbackDashboard', $this->feedback )->getPrefixedText();
 156+ $editorTalkPage = $this->editor->getTalkPage()->getPrefixedText();
 157+ $targetUserTalkPage = $this->targetUser->getTalkPage()->getCanonicalUrl();
 158+ //text version
 159+ $textBody = wfMessage( 'moodbar-enotif-body')->params( $targetUserName,
 160+ $FeedbackUrl,
 161+ $editorTalkPage,
 162+ $this->response,
 163+ $targetUserTalkPage )->escaped();
 164+ $textBody = MessageCache::singleton()->transform( $textBody, false, null, $this->title );
165165
166 - // This is ugly, it's used to add domain name to wiki link so it can be clicked from email.
 166+ //html version, this ugly as we have to make wiki link clickable in emails
167167 $action = $wgRequest->getVal( 'action' );
168168 $wgRequest->setVal( 'action', 'render' );
169 - $htmlResponse = $messageCache->parse( $this->response )->getText();
170 - $wgRequest->setVal( 'action', $action );
171 -
172 - //build the copy text
173 - $textEmailCopy = wfMessage( 'moodbar-enotif-body-copy-text' )->escaped();
174 - $htmlEmailCopy = wfMsgExt( 'moodbar-enotif-body-copy-text', array( 'parse' ) );
175 -
 169+ $htmlBody = wfMsgExt( 'moodbar-enotif-body', array( 'parse' ), $targetUserName,
 170+ $FeedbackUrl,
 171+ $editorTalkPage,
 172+ '<div style="margin-left:20px;">' .$this->response . '</div>',
 173+ $targetUserTalkPage );
 174+ $wgRequest->setVal( 'action', $action );
 175+
176176 //assemable the email body
177177 $this->body = <<<HTML
178178 --$this->mime_boundary
179179 Content-Type: text/plain; charset=UTF-8
180180 Content-Transfer-Encoding: 8bit
181181
182 -$textEmailHeader
 182+$textBody
183183
184 -$textResponse
185 -
186 -$textEmailCopy
187 -
188184 --$this->mime_boundary
189185 Content-Type: text/html; charset=UTF-8
190186 Content-Transfer-Encoding: 8bit
191187
192188 <html>
193189 <body>
194 - $htmlEmailHeader
195 -
196 - $htmlResponse
197 -
198 - $htmlEmailCopy
 190+ $htmlBody
199191 </body>
200192 </html>
201193
Index: trunk/extensions/MoodBar/MoodBar.i18n.php
@@ -163,13 +163,22 @@
164164 'response-ajax-error-body' => 'There was an error adding your response. <br />Please try again later.',
165165 //Email notification
166166 'moodbar-enotif-subject' => '$1 responded to your feedback',
167 - 'moodbar-enotif-text-body-header' => '$1 responded to your feedback: $2',
168 - 'moodbar-enotif-html-body-header' => '[$1 $2] responded to your [$3 feedback]',
169 - 'moodbar-enotif-body-copy-text' => 'View this message on your talk page
 167+
 168+ 'moodbar-enotif-body' => 'Hello $1!
170169
171 -What is a talk page?
 170+Welcome to {{SITENAME}}, and thanks for your [[$2|feedback]]. Another Wikipedia user, [[$3|Responder]], wrote the following response:
172171
173 -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.',
 172+$4
 173+
 174+View this message on your [$5 talk page]
 175+
 176+What’s a talk page?
 177+Your user talk page is the page that other {{SITENAME}} editors use to communicate with you. You can respond by clicking “Edit”, moving the cursor below the comment, typing your response and four tildes (~~~~) to sign, and saving. All pages in {{SITENAME}} have talk pages, and they’re used for many different purposes. It takes a while to get the hang of it, but is pretty easy once you’re used to it.
 178+
 179+Still confused? [http://en.wikipedia.org/wiki/File:Wikipedia_basics_-_Talk_pages.ogv This video] (watch on [http://www.youtube.com/watch?v=JdeDLRsB2Es YouTube]) gives you a step-by-step overview.
 180+
 181+Have a nice day,
 182+-- {{SITENAME}}',
174183 );
175184
176185 /** Message documentation (Message documentation)
@@ -307,9 +316,7 @@
308317 'response-ajax-error-head' => 'Text for ajax status heading on error',
309318 'response-ajax-error-body' => 'Text for ajax status body on error (can be html)',
310319 'moodbar-enotif-subject' => 'Feedback response email subject',
311 - 'moodbar-enotif-text-body-header' => 'The text version email header, $1 is the user name, $2 is the link to the feedback',
312 - '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',
313 - 'moodbar-enotif-body-copy-text' => 'Email copy text',
 320+ 'moodbar-enotif-body' => 'Feedback response email body, $1 is the commenter name, $2 is the link to the feedback of commenter, $3 is the responder talk page, $4 is the response text, $5 is commenter talk page',
314321 );
315322
316323 /** Afrikaans (Afrikaans)

Follow-up revisions

RevisionCommit summaryAuthorDate
r107639followup to -r106223 - remove redundant message transformation and unused var...bsitu18:03, 30 December 2011

Comments

#Comment by Catrope (talk | contribs)   21:59, 14 December 2011
+Welcome to {{SITENAME}}, and thanks for your [[$2|feedback]]. Another Wikipedia user, [[$3|Responder]], wrote the following response:

Huh? Why are you hardcoding the username as Responder?

OK otherwise.

#Comment by Bsitu (talk | contribs)   22:01, 14 December 2011

Roan,

This was fixed in another revision: 106232

Thanks,

#Comment by Catrope (talk | contribs)   22:01, 14 December 2011

Fixed in r106225.

#Comment by Tim Starling (talk | contribs)   05:13, 30 December 2011
+                $textBody = MessageCache::singleton()->transform( $textBody, false, null, $this->title );                                                  

What is the reason for doing this second apparently redundant transformation of the message text? It has the potential to introduce untrusted user input into the HTML.

Status & tagging log