feat: notification on membership acceptance, closes #7835

v1.18.x
Julian Lam 6 years ago
parent c44bf48c01
commit 1a2a381ae3

@ -55,6 +55,7 @@
"event.deleted": "The group \"%1\" has been deleted",
"membership.accept-invitation": "Accept Invitation",
"membership.accept.notification_title": "You are now a member of <strong>%1</strong>",
"membership.invitation-pending": "Invitation Pending",
"membership.join-group": "Join Group",
"membership.leave-group": "Leave Group",

@ -28,6 +28,14 @@ module.exports = function (Groups) {
Groups.acceptMembership = async function (groupName, uid) {
await db.setsRemove(['group:' + groupName + ':pending', 'group:' + groupName + ':invited'], uid);
await Groups.join(groupName, uid);
const notification = await notifications.create({
type: 'group-invite',
bodyShort: '[[groups:membership.accept.notification_title, ' + groupName + ']]',
nid: 'group:' + groupName + ':uid:' + uid + ':invite-accepted',
path: '/groups/' + utils.slugify(groupName),
});
await notifications.push(notification, [uid]);
};
Groups.rejectMembership = async function (groupNames, uid) {

Loading…
Cancel
Save