r49744 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49743‎ | r49744 | r49745 >
Date:01:27, 23 April 2009
Author:nad
Status:deferred
Tags:
Comment:
make articles and cats in emailed message into links
Modified paths:
  • /trunk/extensions/CategoryWatch/CategoryWatch.i18n.php (modified) (history)
  • /trunk/extensions/CategoryWatch/CategoryWatch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryWatch/CategoryWatch.i18n.php
@@ -15,10 +15,10 @@
1616 'categorywatch-emailbody' => "Hi $1, you have received this message because you are watching the \"$2\" category.
1717 This message is to notify you that at $3 user $4 $5.",
1818 'categorywatch-emailsubject' => "Activity involving watched category \"$1\"",
19 - 'categorywatch-catmovein' => "moved $1 into category $2 from $3",
20 - 'categorywatch-catmoveout' => "moved $1 out of category $2 into $3",
21 - 'categorywatch-catadd' => "added $1 to category $2",
22 - 'categorywatch-catsub' => "removed $1 from category $2",
 19+ 'categorywatch-catmovein' => "moved [[$1]] into [[:Category:$2|category $2]] from [[:Category:$3|Category:$3]]",
 20+ 'categorywatch-catmoveout' => "moved [[$1]] out of [[:Category:$2|Category:$2]] into [[:Category:$3|Category:$3]]",
 21+ 'categorywatch-catadd' => "added [[$1]] to category $2",
 22+ 'categorywatch-catsub' => "removed [[$1]] from category $2",
2323 'categorywatch-autocat' => "Automatically watched by $1",
2424 );
2525
Index: trunk/extensions/CategoryWatch/CategoryWatch.php
@@ -15,7 +15,7 @@
1616
1717 if ( !defined('MEDIAWIKI' ) ) die( 'Not an entry point.' );
1818
19 -define( 'CATEGORYWATCH_VERSION', '1.0.0, 2009-03-22' );
 19+define( 'CATEGORYWATCH_VERSION', '1.1.0, 2009-04-21' );
2020
2121 $wgCategoryWatchNotifyEditor = true;
2222 $wgCategoryWatchUseAutoCat = false;
@@ -106,9 +106,9 @@
107107 $message = wfMsg( 'categorywatch-catmovein', $page, $add, $sub );
108108 $this->notifyWatchers( $title, $user, $message );
109109
110 - $title = Title::newFromText( $sub, NS_CATEGORY );
111 - $message = wfMsg( 'categorywatch-catmoveout', $page, $sub, $add );
112 - $this->notifyWatchers( $title, $user, $message );
 110+ #$title = Title::newFromText( $sub, NS_CATEGORY );
 111+ #$message = wfMsg( 'categorywatch-catmoveout', $page, $sub, $add );
 112+ #$this->notifyWatchers( $title, $user, $message );
113113 }
114114 else {
115115
@@ -118,11 +118,11 @@
119119 $this->notifyWatchers( $title, $user, $message );
120120 }
121121
122 - foreach ( $sub as $cat ) {
123 - $title = Title::newFromText( $cat, NS_CATEGORY );
124 - $message = wfMsg( 'categorywatch-catsub', $page, $cat );
125 - $this->notifyWatchers( $title, $user, $message );
126 - }
 122+ #foreach ( $sub as $cat ) {
 123+ # $title = Title::newFromText( $cat, NS_CATEGORY );
 124+ # $message = wfMsg( 'categorywatch-catsub', $page, $cat );
 125+ # $this->notifyWatchers( $title, $user, $message );
 126+ #}
127127 }
128128 }
129129
@@ -145,6 +145,7 @@
146146 foreach ( $res as $row ) {
147147 $watchingUser = User::newFromId( $row->wl_user );
148148 if ( $watchingUser->getOption( 'enotifwatchlistpages' ) && $watchingUser->isEmailConfirmed() ) {
 149+
149150 $to = new MailAddress( $watchingUser );
150151 $timecorrection = $watchingUser->getOption( 'timecorrection' );
151152 $editdate = $wgLang->timeanddate( wfTimestampNow(), true, false, $timecorrection );
@@ -160,6 +161,74 @@
161162 $editdat1,
162163 $edittim2
163164 );
 165+
 166+ $subject = wfMsgForContent( 'enotif_subject' );
 167+ $body = wfMsgForContent( 'enotif_body' );
 168+ $keys = array();
 169+
 170+ if ( $this->oldid ) {
 171+ $difflink = $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid );
 172+ $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
 173+ $keys['$OLDID'] = $this->oldid;
 174+ $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
 175+ } else {
 176+ $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_newpagetext' );
 177+ # clear $OLDID placeholder in the message template
 178+ $keys['$OLDID'] = '';
 179+ $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'created' );
 180+ }
 181+
 182+ if ($wgEnotifImpersonal && $this->oldid)
 183+ $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff', $this->title->getFullURL( "oldid={$this->oldid}&diff=prev" ) );
 184+
 185+ $body = strtr( $body, $keys );
 186+ $pagetitle = $this->title->getPrefixedText();
 187+ $keys['$PAGETITLE'] = $pagetitle;
 188+ $keys['$PAGETITLE_URL'] = $this->title->getFullUrl();
 189+
 190+ $keys['$PAGEMINOREDIT'] = $medit;
 191+ $keys['$PAGESUMMARY'] = $summary;
 192+
 193+ $subject = strtr( $subject, $keys );
 194+
 195+ # Reveal the page editor's address as REPLY-TO address only if
 196+ # the user has not opted-out and the option is enabled at the
 197+ # global configuration level.
 198+ $editor = $this->editor;
 199+ $name = $wgEnotifUseRealName ? $editor->getRealName() : $editor->getName();
 200+ $adminAddress = new MailAddress( $wgPasswordSender, 'WikiAdmin' );
 201+ $editorAddress = new MailAddress( $editor );
 202+ if( $wgEnotifRevealEditorAddress
 203+ && ( $editor->getEmail() != '' )
 204+ && $editor->getOption( 'enotifrevealaddr' ) ) {
 205+ if( $wgEnotifFromEditor ) {
 206+ $from = $editorAddress;
 207+ } else {
 208+ $from = $adminAddress;
 209+ $replyto = $editorAddress;
 210+ }
 211+ } else {
 212+ $from = $adminAddress;
 213+ $replyto = new MailAddress( $wgNoReplyAddress );
 214+ }
 215+
 216+ if( $editor->isIP( $name ) ) {
 217+ #real anon (user:xxx.xxx.xxx.xxx)
 218+ $utext = wfMsgForContent('enotif_anon_editor', $name);
 219+ $subject = str_replace('$PAGEEDITOR', $utext, $subject);
 220+ $keys['$PAGEEDITOR'] = $utext;
 221+ $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent( 'noemailtitle' );
 222+ } else {
 223+ $subject = str_replace('$PAGEEDITOR', $name, $subject);
 224+ $keys['$PAGEEDITOR'] = $name;
 225+ $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name );
 226+ $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
 227+ }
 228+ $userPage = $editor->getUserPage();
 229+ $keys['$PAGEEDITOR_WIKI'] = $userPage->getFullUrl();
 230+ $body = strtr( $body, $keys );
 231+ $body = wordwrap( $body, 72 );
 232+
164233 if ( function_exists( 'userMailer' ) ) {
165234 userMailer(
166235 $to,

Status & tagging log