mirror of
https://github.com/wekan/wekan.git
synced 2026-02-12 19:24:20 +01:00
Add notification, allow watch boards / lists / cards
This commit is contained in:
parent
9ef8ebaf09
commit
9bbdacc79a
24 changed files with 579 additions and 16 deletions
|
|
@ -47,6 +47,21 @@ Users.helpers({
|
|||
return _.contains(invitedBoards, boardId);
|
||||
},
|
||||
|
||||
hasTag(tag) {
|
||||
const {tags = []} = this.profile;
|
||||
return _.contains(tags, tag);
|
||||
},
|
||||
|
||||
hasNotification(activityId) {
|
||||
const {notifications = []} = this.profile;
|
||||
return _.contains(notifications, activityId);
|
||||
},
|
||||
|
||||
getEmailCache() {
|
||||
const {emailCache = []} = this.profile;
|
||||
return emailCache;
|
||||
},
|
||||
|
||||
getInitials() {
|
||||
const profile = this.profile || {};
|
||||
if (profile.initials)
|
||||
|
|
@ -99,6 +114,61 @@ Users.mutations({
|
|||
};
|
||||
},
|
||||
|
||||
addTag(tag) {
|
||||
return {
|
||||
$addToSet: {
|
||||
'profile.tags': tag,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
removeTag(tag) {
|
||||
return {
|
||||
$pull: {
|
||||
'profile.tags': tag,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
toggleTag(tag) {
|
||||
if (this.hasTag(tag))
|
||||
this.removeTag(tag);
|
||||
else
|
||||
this.addTag(tag);
|
||||
},
|
||||
|
||||
addNotification(activityId) {
|
||||
return {
|
||||
$addToSet: {
|
||||
'profile.notifications': activityId,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
removeNotification(activityId) {
|
||||
return {
|
||||
$pull: {
|
||||
'profile.notifications': activityId,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
addEmailCache(text) {
|
||||
return {
|
||||
$addToSet: {
|
||||
'profile.emailCache': text,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
clearEmailCache() {
|
||||
return {
|
||||
$set: {
|
||||
'profile.emailCache': [],
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setAvatarUrl(avatarUrl) {
|
||||
return { $set: { 'profile.avatarUrl': avatarUrl }};
|
||||
},
|
||||
|
|
@ -167,21 +237,18 @@ if (Meteor.isServer) {
|
|||
user.addInvite(boardId);
|
||||
|
||||
try {
|
||||
const { _id, slug } = board;
|
||||
const boardUrl = FlowRouter.url('board', { id: _id, slug });
|
||||
|
||||
const vars = {
|
||||
const params = {
|
||||
user: user.username,
|
||||
inviter: inviter.username,
|
||||
board: board.title,
|
||||
url: boardUrl,
|
||||
url: board.absoluteUrl(),
|
||||
};
|
||||
const lang = user.getLanguage();
|
||||
Email.send({
|
||||
to: user.emails[0].address,
|
||||
from: Accounts.emailTemplates.from,
|
||||
subject: TAPi18n.__('email-invite-subject', vars, lang),
|
||||
text: TAPi18n.__('email-invite-text', vars, lang),
|
||||
subject: TAPi18n.__('email-invite-subject', params, lang),
|
||||
text: TAPi18n.__('email-invite-text', params, lang),
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Meteor.Error('email-fail', e.message);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue