mirror of
https://github.com/wekan/wekan.git
synced 2026-02-03 15:11:48 +01:00
ability to store comment only, actual prevention next
This commit is contained in:
parent
4a0474dfc3
commit
e6276271b1
4 changed files with 44 additions and 7 deletions
|
|
@ -138,9 +138,15 @@ template(name="changePermissionsPopup")
|
|||
li
|
||||
a(class="{{#if isLastAdmin}}disabled{{else}}js-set-normal{{/if}}")
|
||||
| {{_ 'normal'}}
|
||||
unless isAdmin
|
||||
if isNormal
|
||||
i.fa.fa-check
|
||||
span.sub-name {{_ 'normal-desc'}}
|
||||
li
|
||||
a(class="{{#if isLastAdmin}}disabled{{else}}js-set-comment-only{{/if}}")
|
||||
| {{_ 'comment-only'}}
|
||||
if isCommentOnly
|
||||
i.fa.fa-check
|
||||
span.sub-name {{_ 'comment-only-desc'}}
|
||||
if isLastAdmin
|
||||
hr
|
||||
p.quiet.bottom {{_ 'last-admin-desc'}}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,17 @@ Template.memberPopup.helpers({
|
|||
},
|
||||
memberType() {
|
||||
const type = Users.findOne(this.userId).isBoardAdmin() ? 'admin' : 'normal';
|
||||
return TAPi18n.__(type).toLowerCase();
|
||||
if(type == 'normal'){
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
const commentOnly = currentBoard.hasCommentOnly(this.userId)
|
||||
if(commentOnly){
|
||||
return TAPi18n.__('comment-only').toLowerCase();
|
||||
} else {
|
||||
return TAPi18n.__(type).toLowerCase();
|
||||
}
|
||||
} else {
|
||||
return TAPi18n.__(type).toLowerCase();
|
||||
}
|
||||
},
|
||||
isInvited() {
|
||||
return Users.findOne(this.userId).isInvitedTo(Session.get('currentBoard'));
|
||||
|
|
@ -308,11 +318,13 @@ BlazeComponent.extendComponent({
|
|||
}).register('addMemberPopup');
|
||||
|
||||
Template.changePermissionsPopup.events({
|
||||
'click .js-set-admin, click .js-set-normal'(event) {
|
||||
'click .js-set-admin, click .js-set-normal, click .js-set-comment-only'(event) {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
const memberId = this.userId;
|
||||
const isAdmin = $(event.currentTarget).hasClass('js-set-admin');
|
||||
currentBoard.setMemberPermission(memberId, isAdmin);
|
||||
const isCommentOnly = $(event.currentTarget).hasClass('js-set-comment-only');
|
||||
console.log(isCommentOnly)
|
||||
currentBoard.setMemberPermission(memberId, isAdmin, isCommentOnly);
|
||||
Popup.back(1);
|
||||
},
|
||||
});
|
||||
|
|
@ -323,6 +335,16 @@ Template.changePermissionsPopup.helpers({
|
|||
return currentBoard.hasAdmin(this.userId);
|
||||
},
|
||||
|
||||
isNormal() {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
return !currentBoard.hasAdmin(this.userId) && !currentBoard.hasCommentOnly(this.userId);
|
||||
},
|
||||
|
||||
isCommentOnly() {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
return !currentBoard.hasAdmin(this.userId) && currentBoard.hasCommentOnly(this.userId);
|
||||
},
|
||||
|
||||
isLastAdmin() {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
return currentBoard.hasAdmin(this.userId) && (currentBoard.activeAdmins() === 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue