jenkins-bot has submitted this change and it was merged.

Change subject: Use CentralIdLookup instead of hardcoding for CentralAuth
......................................................................


Use CentralIdLookup instead of hardcoding for CentralAuth

Change-Id: I5b2d23588ab6b026d1a2100b9c16a74e9aefbd73
---
M includes/UnreadWikis.php
1 file changed, 6 insertions(+), 11 deletions(-)

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



diff --git a/includes/UnreadWikis.php b/includes/UnreadWikis.php
index e165eaa..5339134 100644
--- a/includes/UnreadWikis.php
+++ b/includes/UnreadWikis.php
@@ -28,24 +28,19 @@
        }
 
        /**
-        * If CentralAuth is installed, use that. Otherwise
-        * assume they're using shared user tables.
+        * Use the user id provided by the CentralIdLookup
         *
         * @param User $user
         * @return EchoUnreadWikis|bool
         */
        public static function newFromUser( User $user ) {
-               if ( class_exists( 'CentralAuthUser' ) ) {
-                       // @todo don't be CA specific (see 
T111302/CentralIdLookup)
-                       $caUser = CentralAuthUser::getInstance( $user );
-                       if ( $caUser->isAttached() ) {
-                               return new self( $caUser->getId() );
-                       } else {
-                               return false;
-                       }
+               $lookup = CentralIdLookup::factory();
+               $id = $lookup->centralIdFromLocalUser( $user, 
CentralIdLookup::AUDIENCE_RAW );
+               if ( !$id ) {
+                       return false;
                }
 
-               return new self( $user->getId() );
+               return new self( $id );
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5b2d23588ab6b026d1a2100b9c16a74e9aefbd73
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to