Cleaned up email notification message formatting:
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 10 Jul 2005 02:52:33 +0000 (02:52 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 10 Jul 2005 02:52:33 +0000 (02:52 +0000)
* Wrap long lines on output (long URLs will not themselves break, though)
* Use correct formatting of user page and watched page links
* For anon editors, don't show a special:emailuser link
* Use shorter form for Special:Watchlist/edit

RELEASE-NOTES
includes/UserMailer.php
languages/Language.php

index 944c1bd..edca29b 100644 (file)
@@ -553,6 +553,7 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new.
 * (bug 2311) New language file for Macedonian
 * Fix nohistory message on empty page history
 * Fix fatal error in history when validation on
+* Cleaned up email notification message formatting
 
 
 === Caveats ===
index 2bb3d9a..ac1b0f4 100644 (file)
@@ -68,7 +68,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) {
        
                // Create the mail object using the Mail::factory method
                $mail_object =& Mail::factory('smtp', $wgSMTP);
-       
+               wfDebug( "Sending mail via PEAR::Mail\n" );
                $mailResult =& $mail_object->send($to, $headers, $body);
                
                # Based on the result return an error string, 
@@ -93,6 +93,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) {
 
                $wgErrorString = '';
                set_error_handler( 'mailErrorHandler' );
+               wfDebug( "Sending mail via internal mail() function\n" );
                mail( $to, $subject, $body, $headers );
                restore_error_handler();
 
@@ -258,7 +259,8 @@ class EmailNotification {
                # http://bugzilla.wikipeda.org/show_bug.cgi?id=603 "Delete + undelete cycle doesn't preserve old_id"
                # However, in the case of a new page which is already watched, we have no previous version to compare
                if( $this->oldid ) {
-                       $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited' );
+                       $difflink = $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid );
+                       $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
                        $keys['$OLDID']   = $this->oldid;
                        $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
                } else {
@@ -271,10 +273,9 @@ class EmailNotification {
                $body = strtr( $body, $keys ); 
                $pagetitle = $this->title->getPrefixedText();
                
-               $keys['%24PAGETITLE_RAWURL'] = wfUrlencode( $pagetitle );
-               $keys['$PAGETITLE_RAWURL']   = wfUrlencode( $pagetitle );
-               $keys['%24PAGETITLE']        = $pagetitle; # needed for the {{localurl:$PAGETITLE}} in the messagetext, "$" appears here as "%24"
                $keys['$PAGETITLE']          = $pagetitle;
+               $keys['$PAGETITLE_URL']      = $this->title->getFullUrl();
+               
                $keys['$PAGETIMESTAMP']      = $article->mTimestamp;    # this is the raw internal timestamp - can be useful, too
                $keys['$PAGEMINOREDIT']      = $medit;
                $keys['$PAGESUMMARY']        = $summary;
@@ -307,19 +308,20 @@ class EmailNotification {
                        $anonUrl = wfUrlencode( $name ) . ' (anonymous user)';
                        $subject = str_replace('$PAGEEDITOR', 'anonymous user '. $name, $subject);
                        
-                       $keys['$PAGEEDITOR_RAWURL']   = $anonUrl;
-                       $keys['%24PAGEEDITOR_RAWURL'] = $anonUrl;
-                       $keys['%24PAGEEDITORE']       = $anon;
-                       $keys['$PAGEEDITOR']          = 'anonymous user ' . $name;
+                       $keys['$PAGEEDITOR']       = 'anonymous user ' . $name;
+                       $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent( 'noemailtitle' );
                } else {
                        $subject = str_replace('$PAGEEDITOR', $name, $subject);
-                       $keys['$PAGEEDITOR_RAWURL']   = wfUrlencode( $name );
-                       $keys['%24PAGEEDITOR_RAWURL'] = wfUrlencode( $name );
-                       $keys['%24PAGEEDITORE']       = $wgUser->getTitleKey();
                        $keys['$PAGEEDITOR']          = $name;
+                       $emailPage = Title::makeTitle( NS_SPECIAL, 'Emailuser/' . $name );
+                       $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
                }
+               $userPage = $wgUser->getUserPage();
+               $keys['$PAGEEDITOR_WIKI'] = $userPage->getFullUrl();
                $body = strtr( $body, $keys );
-       
+               
+               $body = wordwrap( $body, 72 );
+
                # now save this as the constant user-independent part of the message
                $this->from    = $from;
                $this->replyto = $replyto;
index 6f6ff4d..163b491 100644 (file)
@@ -1266,28 +1266,26 @@ at the bottom of the screen (deleting a content page also deletes the accompanyi
 'changed'                      => 'changed',
 'created'                      => 'created',
 'enotif_subject'       => '{{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED by $PAGEEDITOR',
-'enotif_lastvisited' => 'See {{SERVER}}{{localurl:$PAGETITLE_RAWURL|diff=0&oldid=$OLDID}} for all changes since your last visit.',
+'enotif_lastvisited' => 'See $1 for all changes since your last visit.',
 'enotif_body' => 'Dear $WATCHINGUSERNAME,
 
-the {{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED on $PAGEEDITDATE by $PAGEEDITOR,
-see {{SERVER}}{{localurl:$PAGETITLE_RAWURL}} for the current version.
+the {{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED on $PAGEEDITDATE by $PAGEEDITOR, see $PAGETITLE_URL for the current version.
 
 $NEWPAGE
 
 Editor\'s summary: $PAGESUMMARY $PAGEMINOREDIT
 
 Contact the editor:
-mail {{SERVER}}{{localurl:Special:Emailuser|target=$PAGEEDITOR_RAWURL}}
-wiki {{SERVER}}{{localurl:User:$PAGEEDITOR_RAWURL}}
+mail: $PAGEEDITOR_EMAIL
+wiki: $PAGEEDITOR_WIKI
 
-There will be no other notifications in case of further changes unless you visit this page.
-You could also reset the notification flags for all your watched pages on your watchlist.
+There will be no other notifications in case of further changes unless you visit this page. You could also reset the notification flags for all your watched pages on your watchlist.
 
              Your friendly {{SITENAME}} notification system
 
 --
 To change your watchlist settings, visit
-{{SERVER}}{{localurl:Special:Watchlist|edit=yes}}
+{{SERVER}}{{localurl:Special:Watchlist/edit}}
 
 Feedback and further assistance:
 {{SERVER}}{{localurl:Help:Contents}}',