Jdlrobson has uploaded a new change for review.

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

Change subject: Support making collections private
......................................................................

Support making collections private

Bug: T94257
Change-Id: I2586b10807d3934ff6249336f518050e2f477424
---
M resources/ext.gather.api/CollectionsApi.js
M resources/ext.gather.collection.editor/CollectionEditOverlay.js
M resources/ext.gather.collection.editor/content.hogan
3 files changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/68/204668/1

diff --git a/resources/ext.gather.api/CollectionsApi.js 
b/resources/ext.gather.api/CollectionsApi.js
index cb4a3fd..9c4b1dc 100644
--- a/resources/ext.gather.api/CollectionsApi.js
+++ b/resources/ext.gather.api/CollectionsApi.js
@@ -189,13 +189,16 @@
                 * @param {Number} id unique identifier of collection
                 * @param {String} title of collection
                 * @param {String} description of collection
+                * @param {Boolean} isPrivate whether it should be stored as 
private
+                * @return {jQuery.Promise}
                 */
-               editCollection: function ( id, title, description ) {
+               editCollection: function ( id, title, description, isPrivate ) {
                        return this.postWithToken( 'watch', {
                                action: 'editlist',
                                id: id,
                                label: title,
-                               description: description
+                               description: description,
+                               perm: isPrivate ? 'private' : 'public'
                        } );
                },
                /**
diff --git a/resources/ext.gather.collection.editor/CollectionEditOverlay.js 
b/resources/ext.gather.collection.editor/CollectionEditOverlay.js
index 458a8cc..61b9083 100644
--- a/resources/ext.gather.collection.editor/CollectionEditOverlay.js
+++ b/resources/ext.gather.collection.editor/CollectionEditOverlay.js
@@ -190,13 +190,14 @@
                onSaveClick: function () {
                        var title = this.$( 'input.title' ).val(),
                                self = this,
+                               isPrivate = !this.$( '.privacy' ).is( 
':checked' );
                                description = this.$( '.description' ).val();
 
                        if ( this.isTitleValid( title ) && 
this.isDescriptionValid( description ) ) {
                                // disable button and inputs
                                this.showSpinner();
                                this.$( '.mw-ui-input, .save' ).prop( 
'disabled', true );
-                               this.api.editCollection( this.id, title, 
description ).done( function () {
+                               this.api.editCollection( this.id, title, 
description, isPrivate ).done( function () {
                                        // Go back to the page we were and 
reload to avoid having to update the
                                        // JavaScript state.
                                        schema.log( {
diff --git a/resources/ext.gather.collection.editor/content.hogan 
b/resources/ext.gather.collection.editor/content.hogan
index f4226f0..f5e0378 100644
--- a/resources/ext.gather.collection.editor/content.hogan
+++ b/resources/ext.gather.collection.editor/content.hogan
@@ -12,9 +12,8 @@
        <textarea class="mw-ui-input description"
                rows='2'>{{collection.description}}</textarea>
        <div class="mw-ui-checkbox">
-               <input type="checkbox" id="collection-editor-privacy"
-                       {{#collection.public}}checked{{/collection.public}}
-                       disabled />
-               <label for="collection-editor-privacy">{{publicLabel}}</label>
+               <input type="checkbox" class="privacy" 
id="collection-editor-privacy-{{collection.id}}"
+                       {{#collection.public}}checked{{/collection.public}} />
+               <label 
for="collection-editor-privacy-{{collection.id}}">{{publicLabel}}</label>
        </div>
 </div>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2586b10807d3934ff6249336f518050e2f477424
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to