Page MenuHomePhabricator

emailuser_hide.patch

Authored By
bzimport
Nov 21 2014, 8:11 PM
Size
1 KB
Referenced Files
None
Subscribers
None

emailuser_hide.patch

Index: User.php
===================================================================
--- User.php (revision 41858)
+++ User.php (working copy)
@@ -2369,6 +2369,7 @@
);
wfRunHooks( 'UserSaveSettings', array( $this ) );
$this->clearSharedCache();
+ $this->getUserPage()->invalidateCache();
}
/**
@@ -2902,6 +2903,10 @@
* @return \type{\bool} True if allowed
*/
function canSendEmail() {
+ global $wgEnableEmail, $wgEnableUserEmail;
+ if( !wgEnableEmail || !$wgEnableUserEmail ) {
+ return false;
+ }
$canSend = $this->isEmailConfirmed();
wfRunHooks( 'UserCanSendEmail', array( &$this, &$canSend ) );
return $canSend;
Index: Skin.php
===================================================================
--- Skin.php (revision 41858)
+++ Skin.php (working copy)
@@ -1569,14 +1569,10 @@
}
function showEmailUser( $id ) {
- global $wgEnableEmail, $wgEnableUserEmail, $wgUser;
- return $wgEnableEmail &&
- $wgEnableUserEmail &&
- $wgUser->isLoggedIn() && # show only to signed in 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
+ global $wgUser;
+ $targetUser = User::newFromId( $id );
+ return $wgUser->canSendEmail() && # the sending user must have a confirmed email address
+ $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
}
function emailUserLink() {

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1402
Default Alt Text
emailuser_hide.patch (1 KB)

Event Timeline