mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: notification on membership acceptance, closes #7835
This commit is contained in:
@@ -55,6 +55,7 @@
|
|||||||
"event.deleted": "The group \"%1\" has been deleted",
|
"event.deleted": "The group \"%1\" has been deleted",
|
||||||
|
|
||||||
"membership.accept-invitation": "Accept Invitation",
|
"membership.accept-invitation": "Accept Invitation",
|
||||||
|
"membership.accept.notification_title": "You are now a member of <strong>%1</strong>",
|
||||||
"membership.invitation-pending": "Invitation Pending",
|
"membership.invitation-pending": "Invitation Pending",
|
||||||
"membership.join-group": "Join Group",
|
"membership.join-group": "Join Group",
|
||||||
"membership.leave-group": "Leave Group",
|
"membership.leave-group": "Leave Group",
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ module.exports = function (Groups) {
|
|||||||
Groups.acceptMembership = async function (groupName, uid) {
|
Groups.acceptMembership = async function (groupName, uid) {
|
||||||
await db.setsRemove(['group:' + groupName + ':pending', 'group:' + groupName + ':invited'], uid);
|
await db.setsRemove(['group:' + groupName + ':pending', 'group:' + groupName + ':invited'], uid);
|
||||||
await Groups.join(groupName, 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) {
|
Groups.rejectMembership = async function (groupNames, uid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user