Remove usages and hard deprecate User::changeable(By)Group
This commit was reverted before cause it has changed the initialization order and broke FlaggedRevs. Now FlaggedRevs issue was addressed, so we can apply it back. Bug: T254838 Change-Id: Id29024caf06fcd0d7d4e039aea8142e8131d47a7
This commit is contained in:
parent
1d3d790edb
commit
5596e5784a
6 changed files with 16 additions and 4 deletions
|
|
@ -331,7 +331,7 @@ because of Phabricator reports.
|
|||
* wfLocalFile(), deprecated since 1.34, now emits deprecation warnings.
|
||||
* wfFindFile(), deprecated since 1.34, now emits deprecation warnings.
|
||||
* User::getRights(), deprecated since 1.34, now emits deprecation warnings.
|
||||
* User::changeableGroups and ::changeableByGroup were deprecated, use
|
||||
* User::changeableGroups and ::changeableByGroup were hard deprecated, use
|
||||
corresponding methods in UserGroupManager instead.
|
||||
* …
|
||||
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ class ApiQuery extends ApiBase {
|
|||
'WatchedItemStore',
|
||||
'UserEditTracker',
|
||||
'UserOptionsLookup',
|
||||
'UserGroupManager',
|
||||
]
|
||||
],
|
||||
'filerepoinfo' => ApiQueryFileRepoInfo::class,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
use MediaWiki\User\TalkPageNotificationManager;
|
||||
use MediaWiki\User\UserEditTracker;
|
||||
use MediaWiki\User\UserGroupManager;
|
||||
use MediaWiki\User\UserOptionsLookup;
|
||||
|
||||
/**
|
||||
|
|
@ -61,6 +62,9 @@ class ApiQueryUserInfo extends ApiQueryBase {
|
|||
*/
|
||||
private $userOptionsLookup;
|
||||
|
||||
/** @var UserGroupManager */
|
||||
private $userGroupManager;
|
||||
|
||||
/**
|
||||
* @param ApiQuery $query
|
||||
* @param string $moduleName
|
||||
|
|
@ -68,6 +72,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
|
|||
* @param WatchedItemStore $watchedItemStore
|
||||
* @param UserEditTracker $userEditTracker
|
||||
* @param UserOptionsLookup $userOptionsLookup
|
||||
* @param UserGroupManager $userGroupManager
|
||||
*/
|
||||
public function __construct(
|
||||
ApiQuery $query,
|
||||
|
|
@ -75,13 +80,15 @@ class ApiQueryUserInfo extends ApiQueryBase {
|
|||
TalkPageNotificationManager $talkPageNotificationManager,
|
||||
WatchedItemStore $watchedItemStore,
|
||||
UserEditTracker $userEditTracker,
|
||||
UserOptionsLookup $userOptionsLookup
|
||||
UserOptionsLookup $userOptionsLookup,
|
||||
UserGroupManager $userGroupManager
|
||||
) {
|
||||
parent::__construct( $query, $moduleName, 'ui' );
|
||||
$this->talkPageNotificationManager = $talkPageNotificationManager;
|
||||
$this->watchedItemStore = $watchedItemStore;
|
||||
$this->userEditTracker = $userEditTracker;
|
||||
$this->userOptionsLookup = $userOptionsLookup;
|
||||
$this->userGroupManager = $userGroupManager;
|
||||
}
|
||||
|
||||
public function execute() {
|
||||
|
|
@ -188,7 +195,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
if ( isset( $this->prop['changeablegroups'] ) ) {
|
||||
$vals['changeablegroups'] = $user->changeableGroups();
|
||||
$vals['changeablegroups'] = $this->userGroupManager->getGroupsChangeableBy( $this->getAuthority() );
|
||||
ApiResult::setIndexedTagName( $vals['changeablegroups']['add'], 'g' );
|
||||
ApiResult::setIndexedTagName( $vals['changeablegroups']['remove'], 'g' );
|
||||
ApiResult::setIndexedTagName( $vals['changeablegroups']['add-self'], 'g' );
|
||||
|
|
|
|||
|
|
@ -1074,7 +1074,7 @@ class UserrightsPage extends SpecialPage {
|
|||
* ]
|
||||
*/
|
||||
protected function changeableGroups() {
|
||||
return $this->getUser()->changeableGroups();
|
||||
return $this->userGroupManager->getGroupsChangeableBy( $this->getContext()->getAuthority() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4070,6 +4070,7 @@ class User implements Authority, IDBAccessObject, UserIdentity, UserEmailContact
|
|||
* @deprecated since 1.37 Use UserGroupManager::getGroupsChangeableByGroup instead.
|
||||
*/
|
||||
public static function changeableByGroup( $group ) {
|
||||
wfDeprecated( __METHOD__, '1.37' );
|
||||
return MediaWikiServices::getInstance()
|
||||
->getUserGroupManager()
|
||||
->getGroupsChangeableByGroup( $group );
|
||||
|
|
@ -4084,6 +4085,7 @@ class User implements Authority, IDBAccessObject, UserIdentity, UserEmailContact
|
|||
* @deprecated since 1.37 Use UserGroupManager::getGroupsChangeableBy instead.
|
||||
*/
|
||||
public function changeableGroups() {
|
||||
wfDeprecated( __METHOD__, '1.37' );
|
||||
return MediaWikiServices::getInstance()
|
||||
->getUserGroupManager()
|
||||
->getGroupsChangeableBy( $this );
|
||||
|
|
|
|||
|
|
@ -1973,6 +1973,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testChangeableGroups() {
|
||||
$this->setMwGlobals( self::CHANGEABLE_GROUPS_TEST_CONFIG );
|
||||
$this->hideDeprecated( 'User::changeableGroups' );
|
||||
|
||||
$allGroups = User::getAllGroups();
|
||||
|
||||
|
|
@ -2036,6 +2037,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testChangeableByGroup( string $group, array $expected ) {
|
||||
$this->setMwGlobals( self::CHANGEABLE_GROUPS_TEST_CONFIG );
|
||||
$this->hideDeprecated( 'User::changeableByGroup' );
|
||||
$this->assertGroupsEquals( $expected, User::changeableByGroup( $group ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue