Index: trunk/phase3/includes/User.php |
— | — | @@ -811,6 +811,23 @@ |
812 | 812 | } |
813 | 813 | |
814 | 814 | /** |
| 815 | + * Return the talk page(s) this user has new messages on. |
| 816 | + */ |
| 817 | + function getTalkPages() { |
| 818 | + global $wgDBname; |
| 819 | + $talks = array(); |
| 820 | + if (!wfRunHooks('UserRetrieveNewTalks', array(&$this, &$talks))) |
| 821 | + return $talks; |
| 822 | + |
| 823 | + if (!$this->getNewtalk()) |
| 824 | + return array(); |
| 825 | + $up = $this->getUserPage(); |
| 826 | + $utp = $up->getTalkPage(); |
| 827 | + return array(array("wiki" => $wgDBname, "link" => $utp->getLocalURL())); |
| 828 | + } |
| 829 | + |
| 830 | + |
| 831 | + /** |
815 | 832 | * Perform a user_newtalk check on current slaves; if the memcached data |
816 | 833 | * is funky we don't want newtalk state to get stuck on save, as that's |
817 | 834 | * damn annoying. |
— | — | @@ -1224,8 +1241,11 @@ |
1225 | 1242 | function clearNotification( &$title ) { |
1226 | 1243 | global $wgUser, $wgUseEnotif; |
1227 | 1244 | |
| 1245 | + |
1228 | 1246 | if ($title->getNamespace() == NS_USER_TALK && |
1229 | 1247 | $title->getText() == $this->getName() ) { |
| 1248 | + if (!wfRunHooks('UserClearNewTalkNotification', array(&$this))) |
| 1249 | + return; |
1230 | 1250 | $this->setNewtalk( false ); |
1231 | 1251 | } |
1232 | 1252 | |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -2214,15 +2214,17 @@ |
2215 | 2215 | # If this is another user's talk page, update newtalk |
2216 | 2216 | |
2217 | 2217 | if ($this->mTitle->getNamespace() == NS_USER_TALK && $shortTitle != $wgUser->getName()) { |
2218 | | - $other = User::newFromName( $shortTitle ); |
2219 | | - if( is_null( $other ) && User::isIP( $shortTitle ) ) { |
2220 | | - // An anonymous user |
2221 | | - $other = new User(); |
2222 | | - $other->setName( $shortTitle ); |
| 2218 | + if (wfRunHooks('ArticleEditUpdateNewTalk', array(&$this)) ) { |
| 2219 | + $other = User::newFromName( $shortTitle ); |
| 2220 | + if( is_null( $other ) && User::isIP( $shortTitle ) ) { |
| 2221 | + // An anonymous user |
| 2222 | + $other = new User(); |
| 2223 | + $other->setName( $shortTitle ); |
| 2224 | + } |
| 2225 | + if( $other ) { |
| 2226 | + $other->setNewtalk( true ); |
| 2227 | + } |
2223 | 2228 | } |
2224 | | - if( $other ) { |
2225 | | - $other->setNewtalk( true ); |
2226 | | - } |
2227 | 2229 | } |
2228 | 2230 | |
2229 | 2231 | if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -147,6 +147,7 @@ |
148 | 148 | global $wgMaxCredits, $wgShowCreditsIfMax; |
149 | 149 | global $wgPageShowWatchingUsers; |
150 | 150 | global $wgUseTrackbacks; |
| 151 | + global $wgDBname; |
151 | 152 | |
152 | 153 | $fname = 'SkinTemplate::outputPage'; |
153 | 154 | wfProfileIn( $fname ); |
— | — | @@ -269,7 +270,9 @@ |
270 | 271 | } else { |
271 | 272 | $tpl->set('jsvarurl', false); |
272 | 273 | } |
273 | | - if( $wgUser->getNewtalk() ) { |
| 274 | + $newtalks = $wgUser->getTalkPages(); |
| 275 | + |
| 276 | + if (count($newtalks) == 1 && $newtalks[0]["wiki"] === $wgDBname) { |
274 | 277 | $usertitle = $this->mUser->getUserPage(); |
275 | 278 | $usertalktitle = $usertitle->getTalkPage(); |
276 | 279 | if( !$usertalktitle->equals( $this->mTitle ) ) { |
— | — | @@ -287,6 +290,16 @@ |
288 | 291 | # Disable Cache |
289 | 292 | $wgOut->setSquidMaxage(0); |
290 | 293 | } |
| 294 | + } else if (count($newtalks)) { |
| 295 | + $sep = wfMsg("newtalkseperator"); |
| 296 | + $msgs = array(); |
| 297 | + foreach ($newtalks as $newtalk) { |
| 298 | + $msgs[] = wfElement("a", |
| 299 | + array('href' => $newtalk["link"]), $newtalk["wiki"]); |
| 300 | + } |
| 301 | + $parts = implode($sep, $msgs); |
| 302 | + $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts); |
| 303 | + $wgOut->setSquidMaxage(0); |
291 | 304 | } else { |
292 | 305 | $ntl = ''; |
293 | 306 | } |
Index: trunk/phase3/languages/Messages.php |
— | — | @@ -1932,6 +1932,8 @@ |
1933 | 1933 | 'confirm_purge' => "Clear the cache of this page?\n\n$1", |
1934 | 1934 | 'confirm_purge_button' => 'OK', |
1935 | 1935 | |
| 1936 | +'youhavenewmessagesmulti' => "You have new messages on $1", |
| 1937 | +'newtalkseperator' => ', ', |
1936 | 1938 | ); |
1937 | 1939 | |
1938 | 1940 | |