From 9065bc437d75adf2fc7928f7fcc4dd439aa5e37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Such=C3=A1nek?= Date: Tue, 13 Jul 2021 09:52:14 +0200 Subject: [PATCH] Hard deprecate User::isAllowUsertalk Callers should use User::getBlock and AbstractBlock::isUsertalkEditAllowed instead. Replace the only known usage left. Bug: T211276 Change-Id: I505a283433dbe32a0b8150bebb2b716bf6222475 --- RELEASE-NOTES-1.37 | 2 ++ includes/Permissions/PermissionManager.php | 2 +- includes/user/User.php | 11 +++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES-1.37 b/RELEASE-NOTES-1.37 index bb2b731a184..7d432dfbec4 100644 --- a/RELEASE-NOTES-1.37 +++ b/RELEASE-NOTES-1.37 @@ -675,6 +675,8 @@ because of Phabricator reports. - getTitleProtection() - flushRestrictions() - loadRestrictions() +* User::isAllowUsertalk was hard deprecated. Use User::getBlock and + AbstractBlock::isUsertalkEditAllowed instead. * … === Other changes in 1.37 === diff --git a/includes/Permissions/PermissionManager.php b/includes/Permissions/PermissionManager.php index f5e2baa3828..bbe5b802e51 100644 --- a/includes/Permissions/PermissionManager.php +++ b/includes/Permissions/PermissionManager.php @@ -359,7 +359,7 @@ class PermissionManager { } // only for the purpose of the hook. We really don't need this here. - $allowUsertalk = $user->isAllowUsertalk(); + $allowUsertalk = $block->isUsertalkEditAllowed(); // Allow extensions to let a blocked user access a particular page $this->hookRunner->onUserIsBlockedFrom( $user, $title, $blocked, $allowUsertalk ); diff --git a/includes/user/User.php b/includes/user/User.php index 777df66208a..a52e4f43da3 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -239,7 +239,11 @@ class User implements Authority, UserIdentity, UserEmailContact { */ public $mBlock; - /** @var bool */ + /** + * TODO: This should be removed when User::isAllowUsertalk + * is removed. + * @var bool + */ protected $mAllowUsertalk; /** @var AbstractBlock|bool */ @@ -4264,9 +4268,12 @@ class User implements Authority, UserIdentity, UserEmailContact { /** * Checks if usertalk is allowed * - * @return bool + * @deprecated since 1.37 Use AbstractBlock::isUsertalkEditAllowed + * + * @return bool|null Returns null when no block has been loaded */ public function isAllowUsertalk() { + wfDeprecated( __METHOD__, '1.37' ); return $this->mAllowUsertalk; }