Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 5579c60

Browse files
committed
Merge pull request #1430 from OpenBazaar/addModWithGuid
Add add mod with guid
2 parents 0303040 + dd772ae commit 5579c60

File tree

3 files changed

+48
-10
lines changed

3 files changed

+48
-10
lines changed

js/languages/en-US.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@
231231
"SearchForCategory": "Search for category",
232232
"Moderators": "Moderators",
233233
"CurrentModerators": "Current Moderators",
234-
"AddModerators": "Add New Moderators",
234+
"AddModerators": "Add Moderators",
235+
"ManualAddModerator": "Add Moderators by GUID",
236+
"ManualAddModeratorHelp": "Enter the GUIDs of one or more moderators, separated by commas, here. The GUID is on the right side of their About tab on their page. Adding the GUID of a user that is not a moderator will have no effect, that GUID will be ignored.",
235237
"DeselectToRemoveModerator": "Deselect the moderators you want to remove",
236238
"SelectToAddModerator": "Select the moderators you want to add",
237239
"Categories": "Categories",

js/templates/settings.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Basic') %></h3>
729729
<div class="flexCol-9 borderRight0 custCol-border">
730730
<div class="hideTopAndBottomBorder js-settingsCurrentMods">
731731
</div>
732-
<div class="padding10 width100 alignCenter fadeable js-loadingMsg">
732+
<div class="padding10 width100 alignCenter fadeable js-loadingMsgOld">
733733
<i class="ion-android-sync spinner textSize24px textOpacity50"></i>
734734
</div>
735735
</div>
@@ -750,12 +750,32 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Basic') %></h3>
750750
<div class="flexCol-9 borderRight0 custCol-border">
751751
<div class="hideTopAndBottomBorder js-settingsNewMods">
752752
</div>
753-
<div class="padding10 width100 alignCenter fadeable js-loadingMsg">
753+
<div class="padding10 width100 alignCenter fadeable js-loadingMsgNew">
754754
<i class="ion-android-sync spinner textSize24px textOpacity50"></i>
755755
</div>
756756
</div>
757757
</div>
758758

759+
<div class="flexRow">
760+
<div class="flexCol-3 borderRight custCol-border zIndex1"><!-- add z-index so help box overlaps next column-->
761+
<div class="fieldItem">
762+
<label for="addManualMods" class="tooltip tooltip-box" data-tooltip="<%= polyglot.t('ManualAddModeratorHelp') %>">
763+
<%= polyglot.t('ManualAddModerator') %> <i class="ion-help-circled"></i>
764+
</label>
765+
766+
</div>
767+
</div>
768+
769+
<div class="flexCol-9 borderRight0 custCol-border">
770+
<div class="fieldItem padding0">
771+
<input name="manualMods"
772+
type="text"
773+
id="addManualMods"
774+
class="fieldItem">
775+
</div>
776+
</div>
777+
</div>
778+
759779
<div class="flexRow TODO">
760780
<div class="flexCol-3 borderRight custCol-border">
761781
<div class="fieldItem">
@@ -768,6 +788,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Basic') %></h3>
768788
<div class="flexCol-9 borderRight0 custCol-border">
769789
<div class="fieldItem padding0">
770790
<!--TODO: keywords input here -->
791+
<input id="store-keywords">
771792
</div>
772793
</div>
773794
</div>

js/views/settingsVw.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,21 @@ module.exports = Backbone.View.extend({
503503
//don't add unless it comes from the model
504504
if(moderator.fromModel){
505505
this.$el.find('.js-settingsCurrentMods').append(modShort.el);
506+
if(!this.$('.js-loadingMsgOld').hasClass('foldIn')){
507+
//hide spinners after a while
508+
setTimeout(()=> {
509+
this.$('.js-loadingMsgOld').addClass('foldIn');
510+
},2000);
511+
}
506512
}
507513
}else{
508514
this.$el.find('.js-settingsNewMods').append(modShort.el);
515+
if(!this.$('.js-loadingMsgNew').hasClass('foldIn')){
516+
//hide spinners after a while
517+
setTimeout(()=> {
518+
this.$('.js-loadingMsgNew').addClass('foldIn');
519+
},2000);
520+
}
509521
}
510522
this.moderatorCount++;
511523
this.subViews.push(modShort);
@@ -557,10 +569,6 @@ module.exports = Backbone.View.extend({
557569
}
558570
});
559571
}
560-
//hide spinners after a while
561-
setTimeout(()=> {
562-
this.$('.js-loadingMsg').addClass('foldIn');
563-
},3000);
564572
this.firstLoadModerators = false;
565573
} else if (state === 'blocked') {
566574
// Since the Blocked Users View kicks off many server calls (one
@@ -811,9 +819,8 @@ module.exports = Backbone.View.extend({
811819
form = this.$el.find("#storeForm"),
812820
settingsData = {},
813821
moderatorsNew = this.$el.find('#storeForm .js-settingsNewMods .js-userShortView input:checked'),
814-
moderatorList = this.userModel.get('moderators').map(function(moderatorObject){
815-
return moderatorObject.guid;
816-
}),
822+
moderatorList = this.userModel.get('moderator_guids'),
823+
manualModList,
817824
moderatorsUnChecked = this.$('#storeForm .js-settingsCurrentMods .js-userShortView input:not(:checked)'),
818825
onFail,
819826
$saveBtn = this.$('.js-saveStore');
@@ -830,6 +837,14 @@ module.exports = Backbone.View.extend({
830837
moderatorList.push($(this).data('guid'));
831838
});
832839

840+
//add any manually entered mods
841+
manualModList = this.$('#addManualMods').val().split(',');
842+
__.each(manualModList, function(mod){
843+
if(mod.length === 40){
844+
moderatorList.push(mod);
845+
}
846+
});
847+
833848
settingsData.moderators = moderatorList.length > 0 ? moderatorList : "";
834849

835850
onFail = (data) => {

0 commit comments

Comments
 (0)