MediaWiki r42179 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r42178‎ | r42179 (on ViewVC)‎ | 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:

Diff [purge]

Index: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php	(revision 42178)
+++ trunk/phase3/includes/User.php	(revision 42179)
@@ -2381,6 +2381,7 @@
 		);
 		wfRunHooks( 'UserSaveSettings', array( $this ) );
 		$this->clearSharedCache();
+		$this->getUserPage()->invalidateCache();
 	}
 
 	/**
@@ -2914,6 +2915,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: trunk/phase3/includes/Skin.php
===================================================================
--- trunk/phase3/includes/Skin.php	(revision 42178)
+++ trunk/phase3/includes/Skin.php	(revision 42179)
@@ -1573,14 +1573,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() {
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 42178)
+++ trunk/phase3/RELEASE-NOTES	(revision 42179)
@@ -168,7 +168,9 @@
   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 
   $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 14907) DatabasePostgres::fieldType now defined.

Status & tagging log

  • 15:36, 12 September 2011 Meno25 (Talk | contribs) changed the status of r42179 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox