Fix regression in unwatch links sent out by enotif. {{FULLPAGENAMEE}} happens to...
[lhc/web/wiklou.git] / includes / UserMailer.php
index 3e89ea9..daf8b62 100644 (file)
@@ -281,7 +281,7 @@ class EmailNotification {
         * @param $minorEdit
         * @param $oldid (default: false)
         */
-       function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false, $deleted = false ) {
+       function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false) {
                global $wgEnotifUseJobQ, $wgEnotifWatchlist, $wgShowUpdatedMarker;
 
                if ($title->getNamespace() < 0)
@@ -328,13 +328,11 @@ class EmailNotification {
                                "summary" => $summary,
                                "minorEdit" => $minorEdit,
                                "oldid" => $oldid,
-                               "watchers" => $watchers,
-                               "deleted" => $deleted
-                       );
+                               "watchers" => $watchers);
                        $job = new EnotifNotifyJob( $title, $params );
                        $job->insert();
                } else {
-                       $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $deleted );
+                       $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers );
                }
 
        }
@@ -352,7 +350,6 @@ class EmailNotification {
         * @param $minorEdit bool
         * @param $oldid int Revision ID
         * @param $watchers array of user IDs
-        * @param $deleted boolean If page was deleted
         */
        function actuallyNotifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers) {
                # we use $wgPasswordSender as sender's address
@@ -376,7 +373,6 @@ class EmailNotification {
                $this->minorEdit = $minorEdit;
                $this->oldid = $oldid;
                $this->editor = $editor;
-               $this->deleted = $deleted;
                $this->composed_common = false;
 
                $userTalkId = false;
@@ -454,10 +450,6 @@ class EmailNotification {
                        $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
                        $keys['$OLDID']   = $this->oldid;
                        $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
-               } else if( $this->deleted ) {
-                       $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_deletedpagetext' );
-                       $keys['$OLDID']   = '';
-                       $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'deleted' );
                } else {
                        $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_newpagetext' );
                        # clear $OLDID placeholder in the message template
@@ -476,11 +468,11 @@ class EmailNotification {
                $body = strtr( $body, $keys );
                $pagetitle = $this->title->getPrefixedText();
                $keys['$PAGETITLE']          = $pagetitle;
-               $keys['$REVINFO'] = $this->deleted ? '' : 
-                       wfMsgForContent( 'enotif_rev_info', $this->title->getFullUrl() );
+               $keys['$PAGETITLE_URL']      = $this->title->getFullUrl();
 
                $keys['$PAGEMINOREDIT']      = $medit;
                $keys['$PAGESUMMARY']        = $summary;
+               $keys['$UNWATCHURL']         = $this->title->getFullUrl( 'action=unwatch' );
 
                $subject = strtr( $subject, $keys );
 
@@ -582,8 +574,13 @@ class EmailNotification {
                # $PAGEEDITDATE is the time and date of the page change
                # expressed in terms of individual local time of the notification
                # recipient, i.e. watching user
-               $body = str_replace('$PAGEEDITDATE',
-                       $wgContLang->timeanddate( $this->timestamp, true, false, $timecorrection ),
+               $body = str_replace(
+                       array(  '$PAGEEDITDATEANDTIME',
+                               '$PAGEEDITDATE',
+                               '$PAGEEDITTIME' ),
+                       array(  $wgContLang->timeanddate( $this->timestamp, true, false, $timecorrection ),
+                               $wgContLang->date( $this->timestamp, true, false, $timecorrection ),
+                               $wgContLang->time( $this->timestamp, true, false, $timecorrection ) ),
                        $body);
 
                return UserMailer::send($to, $this->from, $this->subject, $body, $this->replyto);