mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
Fix invites
This commit is contained in:
parent
34bd1e9c49
commit
66b45ed35c
2 changed files with 15 additions and 2 deletions
|
@ -82,13 +82,13 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
'click .js-accept-invite'() {
|
||||
const boardId = this.currentData()._id;
|
||||
Meteor.user().removeInvite(boardId);
|
||||
Meteor.call('acceptInvite', boardId);
|
||||
},
|
||||
'click .js-decline-invite'() {
|
||||
const boardId = this.currentData()._id;
|
||||
Meteor.call('quitBoard', boardId, (err, ret) => {
|
||||
if (!err && ret) {
|
||||
Meteor.user().removeInvite(boardId);
|
||||
Meteor.call('acceptInvite', boardId);
|
||||
FlowRouter.go('home');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -952,6 +952,19 @@ if (Meteor.isServer) {
|
|||
} else throw new Meteor.Error('error-board-notAMember');
|
||||
} else throw new Meteor.Error('error-board-doesNotExist');
|
||||
},
|
||||
acceptInvite(boardId) {
|
||||
check(boardId, String);
|
||||
const board = Boards.findOne(boardId);
|
||||
if (!board) {
|
||||
throw new Meteor.Error('error-board-doesNotExist');
|
||||
}
|
||||
|
||||
Meteor.users.update(Meteor.userId(), {
|
||||
$pull: {
|
||||
'profile.invitedBoards': boardId,
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue