mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-14 19:35:38 +00:00
Merge "Replace uses of UserNameUtils::isTemp with UserIdentityUtils::isTemp"
This commit is contained in:
commit
5bf0110b4b
|
@ -213,11 +213,11 @@ class HookUtils {
|
|||
$services = MediaWikiServices::getInstance();
|
||||
$dtConfig = $services->getConfigFactory()->makeConfig( 'discussiontools' );
|
||||
|
||||
$userNameUtils = $services->getUserNameUtils();
|
||||
$userIdentityUtils = $services->getUserIdentityUtils();
|
||||
if (
|
||||
( $feature === static::TOPICSUBSCRIPTION || $feature === static::AUTOTOPICSUB ) &&
|
||||
// Users must be logged in to use topic subscription, and Echo must be installed (T322498)
|
||||
( !$user->isRegistered() || $userNameUtils->isTemp( $user->getName() ) ||
|
||||
( !$user->isRegistered() || $userIdentityUtils->isTemp( $user ) ||
|
||||
!ExtensionRegistry::getInstance()->isLoaded( 'Echo' ) )
|
||||
) {
|
||||
return false;
|
||||
|
|
|
@ -482,7 +482,7 @@ class EventDispatcher {
|
|||
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$editTracker = $services->getUserEditTracker();
|
||||
$userNameUtils = $services->getUserNameUtils();
|
||||
$userIdentityUtils = $services->getUserIdentityUtils();
|
||||
|
||||
$commonData = [
|
||||
'$schema' => '/analytics/mediawiki/talk_page_edit/1.2.0',
|
||||
|
@ -497,7 +497,7 @@ class EventDispatcher {
|
|||
'user_edit_count' => $editTracker->getUserEditCount( $identity ) ?: 0,
|
||||
// Retention-safe values:
|
||||
'user_is_anonymous' => !$identity->isRegistered(),
|
||||
'user_is_temp' => $userNameUtils->isTemp( $identity->getName() ),
|
||||
'user_is_temp' => $userIdentityUtils->isTemp( $identity ),
|
||||
'user_edit_count_bucket' => \UserBucketProvider::getUserEditCountBucket( $identity ) ?: 'N/A',
|
||||
],
|
||||
'database' => $wgDBname,
|
||||
|
|
|
@ -33,7 +33,7 @@ return [
|
|||
$services->getDBLoadBalancerFactory(),
|
||||
$services->getReadOnlyMode(),
|
||||
$services->getUserFactory(),
|
||||
$services->getUserNameUtils()
|
||||
$services->getUserIdentityUtils()
|
||||
);
|
||||
},
|
||||
'DiscussionTools.ThreadItemStore' => static function ( MediaWikiServices $services ): ThreadItemStore {
|
||||
|
|
|
@ -7,7 +7,7 @@ use ConfigFactory;
|
|||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\User\UserFactory;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use MediaWiki\User\UserNameUtils;
|
||||
use MediaWiki\User\UserIdentityUtils;
|
||||
use ReadOnlyMode;
|
||||
use stdClass;
|
||||
use TitleValue;
|
||||
|
@ -29,20 +29,20 @@ class SubscriptionStore {
|
|||
private IConnectionProvider $dbProvider;
|
||||
private ReadOnlyMode $readOnlyMode;
|
||||
private UserFactory $userFactory;
|
||||
private UserNameUtils $userNameUtils;
|
||||
private UserIdentityUtils $userIdentityUtils;
|
||||
|
||||
public function __construct(
|
||||
ConfigFactory $configFactory,
|
||||
IConnectionProvider $dbProvider,
|
||||
ReadOnlyMode $readOnlyMode,
|
||||
UserFactory $userFactory,
|
||||
UserNameUtils $userNameUtils
|
||||
UserIdentityUtils $userIdentityUtils
|
||||
) {
|
||||
$this->config = $configFactory->makeConfig( 'discussiontools' );
|
||||
$this->dbProvider = $dbProvider;
|
||||
$this->readOnlyMode = $readOnlyMode;
|
||||
$this->userFactory = $userFactory;
|
||||
$this->userNameUtils = $userNameUtils;
|
||||
$this->userIdentityUtils = $userIdentityUtils;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +102,7 @@ class SubscriptionStore {
|
|||
array $options = []
|
||||
): array {
|
||||
// Only a registered user can be subscribed
|
||||
if ( !$user->isRegistered() || $this->userNameUtils->isTemp( $user->getName() ) ) {
|
||||
if ( !$user->isRegistered() || $this->userIdentityUtils->isTemp( $user ) ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ class SubscriptionStore {
|
|||
return false;
|
||||
}
|
||||
// Only a registered user can subscribe
|
||||
if ( !$user->isRegistered() || $this->userNameUtils->isTemp( $user->getName() ) ) {
|
||||
if ( !$user->isRegistered() || $this->userIdentityUtils->isTemp( $user ) ) {
|
||||
return false;
|
||||
}
|
||||
$dbw = $this->dbProvider->getPrimaryDatabase();
|
||||
|
@ -248,7 +248,7 @@ class SubscriptionStore {
|
|||
return false;
|
||||
}
|
||||
// Only a registered user can subscribe
|
||||
if ( !$user->isRegistered() || $this->userNameUtils->isTemp( $user->getName() ) ) {
|
||||
if ( !$user->isRegistered() || $this->userIdentityUtils->isTemp( $user ) ) {
|
||||
return false;
|
||||
}
|
||||
$dbw = $this->dbProvider->getPrimaryDatabase();
|
||||
|
|
Loading…
Reference in a new issue