[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Revert "Prevent new users from being sent emails"

2018-01-16 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403485 )

Change subject: Revert "Prevent new users from being sent emails"
..


Revert "Prevent new users from being sent emails"

This reverts commit b52421dedd45fc035a2993d10ea90c878cd77453.

Bug: T184470
Change-Id: I2f5fe8993c6e186cd2df0841292653f8fecc0254
---
M includes/DefaultSettings.php
M includes/specials/SpecialEmailuser.php
M includes/user/User.php
M languages/i18n/en.json
M languages/i18n/qqq.json
5 files changed, 2 insertions(+), 29 deletions(-)

Approvals:
  jenkins-bot: Verified
  Kaldari: Looks good to me, approved



diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index ee10a6d..ab01c5f 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5158,7 +5158,6 @@
 $wgGroupPermissions['user']['applychangetags'] = true;
 $wgGroupPermissions['user']['changetags'] = true;
 $wgGroupPermissions['user']['editcontentmodel'] = true;
-$wgGroupPermissions['user']['sendemail-new-users'] = true;
 
 // Implicit group for accounts that pass $wgAutoConfirmAge
 $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true;
diff --git a/includes/specials/SpecialEmailuser.php 
b/includes/specials/SpecialEmailuser.php
index 06ca04f..f322ac4 100644
--- a/includes/specials/SpecialEmailuser.php
+++ b/includes/specials/SpecialEmailuser.php
@@ -238,35 +238,12 @@
return 'nowikiemail';
}
 
-   if ( $target->getEditCount() === 0 &&
-   ( $sender === null || !$sender->isAllowed( 
'sendemail-new-users' ) )
-   ) {
-   // Determine if target has any other logged actions.
-   $dbr = wfGetDB( DB_REPLICA );
-   $log_id = $dbr->selectField(
-   'logging',
-   'log_id',
-   [
-   'log_user' => $target->getId(),
-   "NOT (log_type = 'newusers' AND 
log_action = 'autocreate')",
-   ],
-   __METHOD__,
-   [ 'LIMIT' => 1 ]
-   );
-
-   if ( !$log_id ) {
-   wfDebug( "User has no logged actions on this 
wiki.\n" );
-
-   return 'nowikiemail';
-   }
-   }
-
if ( $sender !== null && !$target->getOption( 
'email-allow-new-users' ) &&
$sender->isNewbie()
) {
-   wfDebug( "User does not allow user emails from 
new users.\n" );
+   wfDebug( "User does not allow user emails from new 
users.\n" );
 
-   return 'nowikiemail';
+   return 'nowikiemail';
}
 
if ( $sender !== null ) {
diff --git a/includes/user/User.php b/includes/user/User.php
index b26a577..390c4b8 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -179,7 +179,6 @@
'reupload-shared',
'rollback',
'sendemail',
-   'sendemail-new-users',
'siteadmin',
'suppressionlog',
'suppressredirect',
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 2b48338..42ea35c 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1240,7 +1240,6 @@
"right-siteadmin": "Lock and unlock the database",
"right-override-export-depth": "Export pages including linked pages up 
to a depth of 5",
"right-sendemail": "Send email to other users",
-   "right-sendemail-new-users": "Send email to users with no logged 
actions",
"right-managechangetags": "Create and (de)activate 
[[Special:Tags|tags]]",
"right-applychangetags": "Apply [[Special:Tags|tags]] along with one's 
changes",
"right-changetags": "Add and remove arbitrary [[Special:Tags|tags]] on 
individual revisions and log entries",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 8a6f8ee..e7e0f42 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -1435,7 +1435,6 @@
"right-siteadmin": "{{doc-right|siteadmin}}",
"right-override-export-depth": "{{doc-right|override-export-depth}}",
"right-sendemail": "{{doc-right|sendemail}}",
-   "right-sendemail-new-users": "{{doc-right|sendemail-new-users}}",
"right-managechangetags": "{{doc-right|managechangetags}}",
"right-applychangetags": "{{doc-right|applychangetags}}",
"right-changetags": "{{doc-right|changetags}}",

-- 
To view, visit https://gerrit.wikimedia.org/r/403485
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Revert "Prevent new users from being sent emails"

2018-01-10 Thread Dmaza (Code Review)
Hello Niharika29, Florianschmidtwelzow, jenkins-bot, MaxSem, Siebrand, 
Samwilson, Kaldari, Dbarratt, MusikAnimal,

I'd like you to do a code review.  Please visit

https://gerrit.wikimedia.org/r/403485

to review the following change.


Change subject: Revert "Prevent new users from being sent emails"
..

Revert "Prevent new users from being sent emails"

This reverts commit b52421dedd45fc035a2993d10ea90c878cd77453.

Per T184470

Change-Id: I2f5fe8993c6e186cd2df0841292653f8fecc0254
---
M includes/DefaultSettings.php
M includes/specials/SpecialEmailuser.php
M includes/user/User.php
M languages/i18n/en.json
M languages/i18n/qqq.json
5 files changed, 3 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/85/403485/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 06c9ffb..3cd7ef1 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5166,7 +5166,6 @@
 $wgGroupPermissions['user']['applychangetags'] = true;
 $wgGroupPermissions['user']['changetags'] = true;
 $wgGroupPermissions['user']['editcontentmodel'] = true;
-$wgGroupPermissions['user']['sendemail-new-users'] = true;
 
 // Implicit group for accounts that pass $wgAutoConfirmAge
 $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true;
diff --git a/includes/specials/SpecialEmailuser.php 
b/includes/specials/SpecialEmailuser.php
index d57ba09..30eb38d 100644
--- a/includes/specials/SpecialEmailuser.php
+++ b/includes/specials/SpecialEmailuser.php
@@ -224,45 +224,15 @@
wfDebug( "Target is invalid user.\n" );
 
return 'notarget';
-   }
-
-   if ( !$target->isEmailConfirmed() ) {
+   } elseif ( !$target->isEmailConfirmed() ) {
wfDebug( "User has no valid email.\n" );
 
return 'noemail';
-   }
-
-   if ( !$target->canReceiveEmail() ) {
+   } elseif ( !$target->canReceiveEmail() ) {
wfDebug( "User does not allow user emails.\n" );
 
return 'nowikiemail';
-   }
-
-   if (
-   $target->getEditCount() === 0
-   && ( $sender === null || !$sender->isAllowed( 
'sendemail-new-users' ) )
-   ) {
-   // Determine if target has any other logged actions.
-   $dbr = wfGetDB( DB_REPLICA );
-   $log_id = $dbr->selectField(
-   'logging',
-   'log_id',
-   [
-   'log_user' => $target->getId(),
-   "NOT (log_type = 'newusers' AND 
log_action = 'autocreate')",
-   ],
-   __METHOD__,
-   [ 'LIMIT' => 1 ]
-   );
-
-   if ( !$log_id ) {
-   wfDebug( "User has no logged actions on this 
wiki.\n" );
-
-   return 'nowikiemail';
-   }
-   }
-
-   if ( $sender !== null ) {
+   } elseif ( $sender !== null ) {
$blacklist = $target->getOption( 'email-blacklist', [] 
);
if ( $blacklist ) {
$lookup = CentralIdLookup::factory();
diff --git a/includes/user/User.php b/includes/user/User.php
index f31d61b..854ebbd 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -178,7 +178,6 @@
'reupload-shared',
'rollback',
'sendemail',
-   'sendemail-new-users',
'siteadmin',
'suppressionlog',
'suppressredirect',
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 767c0a6..5083bed 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1237,7 +1237,6 @@
"right-siteadmin": "Lock and unlock the database",
"right-override-export-depth": "Export pages including linked pages up 
to a depth of 5",
"right-sendemail": "Send email to other users",
-   "right-sendemail-new-users": "Send email to users with no logged 
actions",
"right-managechangetags": "Create and (de)activate 
[[Special:Tags|tags]]",
"right-applychangetags": "Apply [[Special:Tags|tags]] along with one's 
changes",
"right-changetags": "Add and remove arbitrary [[Special:Tags|tags]] on 
individual revisions and log entries",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 7b5b3c2..862f64c 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -1431,7 +1431,6 @@
"right-siteadmin": "{{doc-right|siteadmin}}",