add: invite user via email, invited user can accept or decline, allow member to quit

This commit is contained in:
floatinghotpot 2015-12-07 11:15:57 +08:00
parent d4c5310d65
commit 011f53ad08
11 changed files with 367 additions and 61 deletions

View file

@ -17,6 +17,11 @@ BlazeComponent.extendComponent({
return user && user.hasStarred(this.currentData()._id);
},
isInvited() {
const user = Meteor.user();
return user && user.isInvitedTo(this.currentData()._id);
},
events() {
return [{
'click .js-add-board': Popup.open('createBoard'),
@ -25,6 +30,19 @@ BlazeComponent.extendComponent({
Meteor.user().toggleBoardStar(boardId);
evt.preventDefault();
},
'click .js-accept-invite'() {
const boardId = this.currentData()._id;
Meteor.user().removeInvite(boardId);
},
'click .js-decline-invite'() {
const boardId = this.currentData()._id;
Meteor.call('quitBoard', boardId, (err, ret) => {
if (!err && ret) {
Meteor.user().removeInvite(boardId);
FlowRouter.go('home');
}
});
},
}];
},
}).register('boardList');