* (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
This commit is contained in:
Brion Vibber 2008-10-17 22:20:07 +00:00
parent 5231eecc1e
commit 65bbc14783
3 changed files with 12 additions and 9 deletions

View file

@ -168,7 +168,9 @@ The following extensions are migrated into MediaWiki 1.14:
lead to this hook being called (it was previously only called from within Article.php lead to this hook being called (it was previously only called from within Article.php
* Maximum execution time for shell processes on linux is now configured with * Maximum execution time for shell processes on linux is now configured with
$wgMaxShellTime (180 seconds by default) $wgMaxShellTime (180 seconds by default)
* (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
=== Bug fixes in 1.14 === === Bug fixes in 1.14 ===
* (bug 14907) DatabasePostgres::fieldType now defined. * (bug 14907) DatabasePostgres::fieldType now defined.

View file

@ -1573,14 +1573,10 @@ END;
} }
function showEmailUser( $id ) { function showEmailUser( $id ) {
global $wgEnableEmail, $wgEnableUserEmail, $wgUser; global $wgUser;
return $wgEnableEmail && $targetUser = User::newFromId( $id );
$wgEnableUserEmail && return $wgUser->canSendEmail() && # the sending user must have a confirmed email address
$wgUser->isLoggedIn() && # show only to signed in users $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
0 != $id; # we can only email to non-anons ..
# '' != $id->getEmail() && # who must have an email address stored ..
# 0 != $id->getEmailauthenticationtimestamp() && # .. which is authenticated
# 1 != $wgUser->getOption('disablemail'); # and not disabled
} }
function emailUserLink() { function emailUserLink() {

View file

@ -2381,6 +2381,7 @@ class User {
); );
wfRunHooks( 'UserSaveSettings', array( $this ) ); wfRunHooks( 'UserSaveSettings', array( $this ) );
$this->clearSharedCache(); $this->clearSharedCache();
$this->getUserPage()->invalidateCache();
} }
/** /**
@ -2914,6 +2915,10 @@ class User {
* @return \type{\bool} True if allowed * @return \type{\bool} True if allowed
*/ */
function canSendEmail() { function canSendEmail() {
global $wgEnableEmail, $wgEnableUserEmail;
if( !$wgEnableEmail || !$wgEnableUserEmail ) {
return false;
}
$canSend = $this->isEmailConfirmed(); $canSend = $this->isEmailConfirmed();
wfRunHooks( 'UserCanSendEmail', array( &$this, &$canSend ) ); wfRunHooks( 'UserCanSendEmail', array( &$this, &$canSend ) );
return $canSend; return $canSend;