Merge "Setup: Remove internal short-cut config $wgUseEnotif"
This commit is contained in:
commit
7efe7727a0
5 changed files with 23 additions and 24 deletions
|
|
@ -199,9 +199,7 @@ unset( $rcMaxAgeDays );
|
|||
|
||||
$wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
|
||||
|
||||
if ( $wgEnableEmail ) {
|
||||
$wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
|
||||
} else {
|
||||
if ( !$wgEnableEmail ) {
|
||||
// Disable all other email settings automatically if $wgEnableEmail
|
||||
// is set to false. - T65678
|
||||
$wgAllowHTMLEmail = false;
|
||||
|
|
@ -216,7 +214,6 @@ if ( $wgEnableEmail ) {
|
|||
$wgEnotifUserTalk = false;
|
||||
$wgEnotifWatchlist = false;
|
||||
unset( $wgGroupPermissions['user']['sendemail'] );
|
||||
$wgUseEnotif = false;
|
||||
$wgUserEmailUseReplyTo = false;
|
||||
$wgUsersNotifiedOnAllChanges = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -411,8 +411,6 @@ class RecentChange implements Taggable {
|
|||
public function save( $send = self::SEND_FEED ) {
|
||||
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$putIPinRC = $mainConfig->get( MainConfigNames::PutIPinRC );
|
||||
$useEnotif = $mainConfig->get( 'UseEnotif' );
|
||||
$showUpdatedMarker = $mainConfig->get( MainConfigNames::ShowUpdatedMarker );
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
if ( !is_array( $this->mExtra ) ) {
|
||||
$this->mExtra = [];
|
||||
|
|
@ -501,7 +499,10 @@ class RecentChange implements Taggable {
|
|||
}
|
||||
|
||||
# E-mail notifications
|
||||
if ( $useEnotif || $showUpdatedMarker ) {
|
||||
if ( $mainConfig->get( MainConfigNames::EnotifUserTalk ) ||
|
||||
$mainConfig->get( MainConfigNames::EnotifWatchlist ) ||
|
||||
$mainConfig->get( MainConfigNames::ShowUpdatedMarker )
|
||||
) {
|
||||
$userFactory = MediaWikiServices::getInstance()->getUserFactory();
|
||||
$editor = $userFactory->newFromUserIdentity( $this->getPerformerIdentity() );
|
||||
$page = $this->getPage();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ class WatchlistManager {
|
|||
* @internal For use by ServiceWiring
|
||||
*/
|
||||
public const CONSTRUCTOR_OPTIONS = [
|
||||
'UseEnotif',
|
||||
MainConfigNames::EnotifUserTalk,
|
||||
MainConfigNames::EnotifWatchlist,
|
||||
MainConfigNames::ShowUpdatedMarker,
|
||||
];
|
||||
|
||||
|
|
@ -164,7 +165,8 @@ class WatchlistManager {
|
|||
|
||||
$user = $performer->getUser();
|
||||
|
||||
if ( !$this->options->get( 'UseEnotif' ) &&
|
||||
if ( !$this->options->get( MainConfigNames::EnotifUserTalk ) &&
|
||||
!$this->options->get( MainConfigNames::EnotifWatchlist ) &&
|
||||
!$this->options->get( MainConfigNames::ShowUpdatedMarker )
|
||||
) {
|
||||
$this->talkPageNotificationManager->removeUserHasNewMessages( $user );
|
||||
|
|
@ -229,7 +231,8 @@ class WatchlistManager {
|
|||
$this->talkPageNotificationManager->clearForPageView( $userIdentity, $oldRev );
|
||||
}
|
||||
|
||||
if ( !$this->options->get( 'UseEnotif' ) &&
|
||||
if ( !$this->options->get( MainConfigNames::EnotifUserTalk ) &&
|
||||
!$this->options->get( MainConfigNames::EnotifWatchlist ) &&
|
||||
!$this->options->get( MainConfigNames::ShowUpdatedMarker )
|
||||
) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ class SetupDynamicConfigTest extends MediaWikiUnitTestCase {
|
|||
'backend' => 'local-backend',
|
||||
],
|
||||
'CookiePrefix' => 'my_wiki',
|
||||
'UseEnotif' => false,
|
||||
'Localtimezone' => 'UTC',
|
||||
'LocalTZoffset' => 0,
|
||||
'DBerrorLogTZ' => 'UTC',
|
||||
|
|
@ -649,10 +648,6 @@ class SetupDynamicConfigTest extends MediaWikiUnitTestCase {
|
|||
[ 'CookiePrefix' => 'n=o,t;a l+l.o"w\'e\\d[' ],
|
||||
[ 'CookiePrefix' => 'n_o_t_a_l_l_o_w_e_d_' ],
|
||||
];
|
||||
yield '$wgEnotifUserTalk true' => [
|
||||
[ 'EnotifUserTalk' => true ],
|
||||
[ 'UseEnotif' => true ],
|
||||
];
|
||||
yield '$wgEnableEmail set to false' => [
|
||||
[
|
||||
'EnableEmail' => false,
|
||||
|
|
@ -668,7 +663,6 @@ class SetupDynamicConfigTest extends MediaWikiUnitTestCase {
|
|||
'EnotifUserTalk' => true,
|
||||
'EnotifWatchlist' => true,
|
||||
'GroupPermissions' => [ 'user' => [ 'sendemail' => true ] ],
|
||||
'UseEnotif' => true,
|
||||
'UserEmailUseReplyTo' => true,
|
||||
'UsersNotifiedOnAllChanges' => [ 'Admin' ],
|
||||
], [
|
||||
|
|
@ -684,7 +678,6 @@ class SetupDynamicConfigTest extends MediaWikiUnitTestCase {
|
|||
'EnotifUserTalk' => false,
|
||||
'EnotifWatchlist' => false,
|
||||
'GroupPermissions' => [ 'user' => [] ],
|
||||
'UseEnotif' => false,
|
||||
'UserEmailUseReplyTo' => false,
|
||||
'UsersNotifiedOnAllChanges' => [],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
|
||||
private function getManager( array $params = [] ) {
|
||||
$config = $params['config'] ?? [
|
||||
'UseEnotif' => false,
|
||||
MainConfigNames::EnotifUserTalk => false,
|
||||
MainConfigNames::EnotifWatchlist => false,
|
||||
MainConfigNames::ShowUpdatedMarker => false,
|
||||
];
|
||||
$options = new ServiceOptions(
|
||||
|
|
@ -149,7 +150,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
|
||||
public function testClearAllUserNotifications_configDisabled() {
|
||||
// ********** Code path #3 **********
|
||||
// Early return: config with `UseEnotif` and `ShowUpdatedMarker` both false
|
||||
// Early return: config with `EnotifUserTalk`, `EnotifWatchlist` and `ShowUpdatedMarker` are false
|
||||
|
||||
$userIdentity = new UserIdentityValue( 100, 'User Name' );
|
||||
list( $authority, $userFactory ) = $this->getAuthorityAndUserFactory(
|
||||
|
|
@ -180,7 +181,8 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
// Early return: user's id is falsey
|
||||
|
||||
$config = [
|
||||
'UseEnotif' => true,
|
||||
MainConfigNames::EnotifUserTalk => true,
|
||||
MainConfigNames::EnotifWatchlist => true,
|
||||
MainConfigNames::ShowUpdatedMarker => true
|
||||
];
|
||||
|
||||
|
|
@ -209,7 +211,8 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
// No early returns
|
||||
|
||||
$config = [
|
||||
'UseEnotif' => true,
|
||||
MainConfigNames::EnotifUserTalk => true,
|
||||
MainConfigNames::EnotifWatchlist => true,
|
||||
MainConfigNames::ShowUpdatedMarker => true
|
||||
];
|
||||
|
||||
|
|
@ -303,7 +306,7 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
*/
|
||||
public function testClearTitleUserNotifications_configDisabled( $testPageFactory ) {
|
||||
// ********** Code path #3 **********
|
||||
// Early return: config with `UseEnotif` and `ShowUpdatedMarker` both false
|
||||
// Early return: config with `EnotifUserTalk` and `ShowUpdatedMarker` both false
|
||||
|
||||
$title = $testPageFactory( 100, NS_USER_TALK, 'PageTitleGoesHere' );
|
||||
|
||||
|
|
@ -336,7 +339,8 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
$title = $testPageFactory( 100, NS_USER_TALK, 'PageTitleGoesHere' );
|
||||
|
||||
$config = [
|
||||
'UseEnotif' => true,
|
||||
MainConfigNames::EnotifUserTalk => true,
|
||||
MainConfigNames::EnotifWatchlist => true,
|
||||
MainConfigNames::ShowUpdatedMarker => true
|
||||
];
|
||||
|
||||
|
|
@ -370,7 +374,8 @@ class WatchlistManagerUnitTest extends MediaWikiUnitTestCase {
|
|||
$title = $testPageFactory( 100, NS_USER_TALK, 'PageTitleGoesHere' );
|
||||
|
||||
$config = [
|
||||
'UseEnotif' => true,
|
||||
MainConfigNames::EnotifUserTalk => true,
|
||||
MainConfigNames::EnotifWatchlist => true,
|
||||
MainConfigNames::ShowUpdatedMarker => true
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue