Rjain has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75645


Change subject: Added the permissions plugin
......................................................................

Added the permissions plugin

Just tried adding the permissions plugin, the username and id are stored in the
annotation_json column but currently the username is not displayed with the
annotations.

Change-Id: Idefe71b7f0a991f32db94d3ee26e77943320a6b2
---
M api/ApiAnnotatorRead.php
M modules/Annotator.js
2 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Annotator 
refs/changes/45/75645/1

diff --git a/api/ApiAnnotatorRead.php b/api/ApiAnnotatorRead.php
index c206858..9e54c2d 100644
--- a/api/ApiAnnotatorRead.php
+++ b/api/ApiAnnotatorRead.php
@@ -32,6 +32,8 @@
                $result->addValue( 'ranges', 'startOffset', 
$annotation->ranges[0]->startOffset );
                $result->addValue( 'ranges', 'end', $annotation->ranges[0]->end 
);
                $result->addValue( 'ranges', 'endOffset', 
$annotation->ranges[0]->endOffset );
+               $result->addValue( 'user', 'id', $annotation->user->id );
+               $result->addValue( 'user', 'username', 
$annotation->user->username );
                return true;
        }
 
diff --git a/modules/Annotator.js b/modules/Annotator.js
index 6b7ce51..95bd112 100755
--- a/modules/Annotator.js
+++ b/modules/Annotator.js
@@ -23,5 +23,18 @@
         'revid': revid
       }
     });
+    
+    //add the permissions plugin
+    annotations.annotator('addPlugin', 'Permissions', {
+      user: {
+        id: mw.config.get( 'wgUserId' ),
+        username: mw.user.name()
+      },
+      permissions: {
+        'read': [],
+        'update': [],
+        'delete': []
+      }
+    });
   } )
 }( mediaWiki, jQuery ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idefe71b7f0a991f32db94d3ee26e77943320a6b2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Annotator
Gerrit-Branch: master
Gerrit-Owner: Rjain <[email protected]>

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

Reply via email to