r42179 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42178‎ | r42179 | r42180 >
Date:22:20, 17 October 2008
Author:brion
Status:old
Tags:
Comment:
* (bug 1306) 'Email user' link no longer shown on user page when emailing
is not available due to lack of confirmed address or disabled preference
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -2381,6 +2381,7 @@
23822382 );
23832383 wfRunHooks( 'UserSaveSettings', array( $this ) );
23842384 $this->clearSharedCache();
 2385+ $this->getUserPage()->invalidateCache();
23852386 }
23862387
23872388 /**
@@ -2914,6 +2915,10 @@
29152916 * @return \type{\bool} True if allowed
29162917 */
29172918 function canSendEmail() {
 2919+ global $wgEnableEmail, $wgEnableUserEmail;
 2920+ if( !$wgEnableEmail || !$wgEnableUserEmail ) {
 2921+ return false;
 2922+ }
29182923 $canSend = $this->isEmailConfirmed();
29192924 wfRunHooks( 'UserCanSendEmail', array( &$this, &$canSend ) );
29202925 return $canSend;
Index: trunk/phase3/includes/Skin.php
@@ -1573,14 +1573,10 @@
15741574 }
15751575
15761576 function showEmailUser( $id ) {
1577 - global $wgEnableEmail, $wgEnableUserEmail, $wgUser;
1578 - return $wgEnableEmail &&
1579 - $wgEnableUserEmail &&
1580 - $wgUser->isLoggedIn() && # show only to signed in users
1581 - 0 != $id; # we can only email to non-anons ..
1582 -# '' != $id->getEmail() && # who must have an email address stored ..
1583 -# 0 != $id->getEmailauthenticationtimestamp() && # .. which is authenticated
1584 -# 1 != $wgUser->getOption('disablemail'); # and not disabled
 1577+ global $wgUser;
 1578+ $targetUser = User::newFromId( $id );
 1579+ return $wgUser->canSendEmail() && # the sending user must have a confirmed email address
 1580+ $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
15851581 }
15861582
15871583 function emailUserLink() {
Index: trunk/phase3/RELEASE-NOTES
@@ -168,7 +168,9 @@
169169 lead to this hook being called (it was previously only called from within Article.php
170170 * Maximum execution time for shell processes on linux is now configured with
171171 $wgMaxShellTime (180 seconds by default)
172 -
 172+* (bug 1306) 'Email user' link no longer shown on user page when emailing
 173+ is not available due to lack of confirmed address or disabled preference
 174+
173175 === Bug fixes in 1.14 ===
174176
175177 * (bug 14907) DatabasePostgres::fieldType now defined.

Status & tagging log