Index: branches/REL1_5/phase3/includes/User.php |
— | — | @@ -785,6 +785,22 @@ |
786 | 786 | return ( 0 != $this->mNewtalk ); |
787 | 787 | } |
788 | 788 | |
| 789 | + /** |
| 790 | + * Return the talk page(s) this user has new messages on. |
| 791 | + */ |
| 792 | + function getNewMessageLinks() { |
| 793 | + global $wgDBname; |
| 794 | + $talks = array(); |
| 795 | + if (!wfRunHooks('UserRetrieveNewTalks', array(&$this, &$talks))) |
| 796 | + return $talks; |
| 797 | + |
| 798 | + if (!$this->getNewtalk()) |
| 799 | + return array(); |
| 800 | + $up = $this->getUserPage(); |
| 801 | + $utp = $up->getTalkPage(); |
| 802 | + return array(array("wiki" => $wgDBname, "link" => $utp->getLocalURL())); |
| 803 | + } |
| 804 | + |
789 | 805 | function setNewtalk( $val ) { |
790 | 806 | $this->loadFromDatabase(); |
791 | 807 | $this->mNewtalk = $val; |
Index: branches/REL1_5/phase3/includes/Article.php |
— | — | @@ -2070,21 +2070,27 @@ |
2071 | 2071 | # Update newtalk status if user is reading their own |
2072 | 2072 | # talk page |
2073 | 2073 | |
| 2074 | + if (!wfRunHooks('UserClearNewTalkNotification', array(&$this))) |
| 2075 | + return; |
| 2076 | + |
2074 | 2077 | global $wgUser; |
2075 | | - if ($this->mTitle->getNamespace() == NS_USER_TALK && |
2076 | | - $this->mTitle->getText() == $wgUser->getName()) |
2077 | | - { |
2078 | | - if ( $wgUseEnotif ) { |
2079 | | - require_once( 'UserTalkUpdate.php' ); |
2080 | | - $u = new UserTalkUpdate( 0, $this->mTitle->getNamespace(), $this->mTitle->getDBkey(), false, false, false ); |
2081 | | - } else { |
2082 | | - $wgUser->setNewtalk(0); |
2083 | | - $wgUser->saveNewtalk(); |
| 2078 | + if (wfRunHooks('ArticleEditUpdateNewTalk', array(&$this)) ) { |
| 2079 | + if ($this->mTitle->getNamespace() == NS_USER_TALK && |
| 2080 | + $this->mTitle->getText() == $wgUser->getName()) |
| 2081 | + { |
| 2082 | + |
| 2083 | + if ( $wgUseEnotif ) { |
| 2084 | + require_once( 'UserTalkUpdate.php' ); |
| 2085 | + $u = new UserTalkUpdate( 0, $this->mTitle->getNamespace(), |
| 2086 | + $this->mTitle->getDBkey(), false, false, false ); |
| 2087 | + } else { |
| 2088 | + $wgUser->setNewtalk(0); |
| 2089 | + $wgUser->saveNewtalk(); |
| 2090 | + } |
| 2091 | + } elseif ( $wgUseEnotif ) { |
| 2092 | + $wgUser->clearNotification( $this->mTitle ); |
2084 | 2093 | } |
2085 | | - } elseif ( $wgUseEnotif ) { |
2086 | | - $wgUser->clearNotification( $this->mTitle ); |
2087 | 2094 | } |
2088 | | - |
2089 | 2095 | } |
2090 | 2096 | |
2091 | 2097 | /** |
Index: branches/REL1_5/phase3/includes/SkinTemplate.php |
— | — | @@ -150,6 +150,7 @@ |
151 | 151 | global $wgMaxCredits, $wgShowCreditsIfMax; |
152 | 152 | global $wgPageShowWatchingUsers; |
153 | 153 | global $wgUseTrackbacks; |
| 154 | + global $wgDBname; |
154 | 155 | |
155 | 156 | $fname = 'SkinTemplate::outputPage'; |
156 | 157 | wfProfileIn( $fname ); |
— | — | @@ -264,7 +265,9 @@ |
265 | 266 | } else { |
266 | 267 | $tpl->set('jsvarurl', false); |
267 | 268 | } |
268 | | - if( $wgUser->getNewtalk() ) { |
| 269 | + $newtalks = $wgUser->getNewMessageLinks(); |
| 270 | + |
| 271 | + if (count($newtalks) == 1 && $newtalks[0]["wiki"] === $wgDBname) { |
269 | 272 | $usertitle = $this->mUser->getUserPage(); |
270 | 273 | $usertalktitle = $usertitle->getTalkPage(); |
271 | 274 | if( !$usertalktitle->equals( $this->mTitle ) ) { |
— | — | @@ -277,6 +280,16 @@ |
278 | 281 | # Disable Cache |
279 | 282 | $wgOut->setSquidMaxage(0); |
280 | 283 | } |
| 284 | + } else if (count($newtalks)) { |
| 285 | + $sep = wfMsgHtml("newtalkseperator"); |
| 286 | + $msgs = array(); |
| 287 | + foreach ($newtalks as $newtalk) { |
| 288 | + $msgs[] = wfElement("a", |
| 289 | + array('href' => $newtalk["link"]), $newtalk["wiki"]); |
| 290 | + } |
| 291 | + $parts = implode($sep, $msgs); |
| 292 | + $ntl = wfMsgHtml('youhavenewmessagesmulti', $parts); |
| 293 | + $wgOut->setSquidMaxage(0); |
281 | 294 | } else { |
282 | 295 | $ntl = ''; |
283 | 296 | } |
Index: branches/REL1_5/phase3/languages/Language.php |
— | — | @@ -2127,6 +2127,8 @@ |
2128 | 2128 | |
2129 | 2129 | 'unit-pixel' => 'px', |
2130 | 2130 | |
| 2131 | +'youhavenewmessagesmulti' => "You have new messages on $1", |
| 2132 | +'newtalkseperator' => ', ', |
2131 | 2133 | ); |
2132 | 2134 | |
2133 | 2135 | /* a fake language converter */ |