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

Change subject: Allow logged out users to view
......................................................................


Allow logged out users to view

(bug 52260)
Change-Id: I3b7174ec78c9419fe56871dc46fc0f06826dd138
---
M Annotator.hooks.php
M modules/Annotator.js
2 files changed, 35 insertions(+), 30 deletions(-)

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



diff --git a/Annotator.hooks.php b/Annotator.hooks.php
index 2982fe5..1364833 100755
--- a/Annotator.hooks.php
+++ b/Annotator.hooks.php
@@ -29,7 +29,7 @@
                /*
                 module is added only when then namespace matches and user is 
logged in
                */
-                if( $skin->getTitle()->inNamespaces( array( NS_MAIN, NS_TALK, 
NS_CATEGORY ) ) && $output->getUser()->isLoggedIn() ) {
+                if( $skin->getTitle()->inNamespaces( array( NS_MAIN, NS_TALK, 
NS_CATEGORY ) ) ) {
                        $output->addModules( 'ext.annotator' );
                }
                return true;            
diff --git a/modules/Annotator.js b/modules/Annotator.js
index b4ab400..3a25f07 100755
--- a/modules/Annotator.js
+++ b/modules/Annotator.js
@@ -10,7 +10,12 @@
                //Get the userId
                userId = mw.config.get( 'wgUserId' );
                //Call the annotations
-               annotations = $( '#mw-content-text' ).annotator();
+               if( userId === null ) {
+                       annotations = $( '#mw-content-text' ).annotator({ 
readOnly: true });
+               }
+               else {
+                       annotations = $( '#mw-content-text' ).annotator();
+               }
                //Add the store plugin and modify the urls according to 
mediawiki api
                annotations.annotator( 'addPlugin', 'Store', {
                        prefix: mw.util.wikiScript( 'api' ),
@@ -26,32 +31,32 @@
                        }
                } );
 
-    //add the permissions plugin
-    annotations.annotator('addPlugin', 'Permissions', {
-      
-      user: {
-        id: userId,
-        username: mw.user.getName()
-      },
-      permissions: {
-        'read': [],
-        'update': [ userId ],
-        'delete': [ userId ]
-      },
-      userId: function (user) {
-        if( user && user.id ) {
-          return user.id;
-        }
-        return user;
-      },
-      userString: function (user) {
-        if( user && user.username ) {
-          return user.username;
-        }
-        return user;
-      },
-      showViewPermissionsCheckbox: false,
-      showEditPermissionsCheckbox: false
-    });
-  } )
+               //add the permissions plugin
+               annotations.annotator('addPlugin', 'Permissions', {
+                       
+                       user: {
+                               id: userId,
+                               username: mw.user.getName()
+                       },
+                       permissions: {
+                               'read': [],
+                               'update': [ userId ],
+                               'delete': [ userId ]
+                       },
+                       userId: function (user) {
+                               if( user && user.id ) {
+                                       return user.id;
+                               }
+                               return user;
+                       },
+                       userString: function (user) {
+                               if( user && user.username ) {
+                                       return user.username;
+                               }
+                               return user;
+                       },
+                       showViewPermissionsCheckbox: false,
+                       showEditPermissionsCheckbox: false
+               });
+       } )
 }( mediaWiki, jQuery ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b7174ec78c9419fe56871dc46fc0f06826dd138
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Annotator
Gerrit-Branch: master
Gerrit-Owner: Rjain <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Rjain <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to