mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
Updating group.removeMember api to send an email for rescinded party invite (#8280)
* feature: updating group.removeMember api to send an email to a user when an invite was rescinded or when no message was provided by the performing user. * Adding validation that the email is being sent to the right user. * fixing linting error
This commit is contained in:
@@ -468,9 +468,10 @@ api.leaveGroup = {
|
||||
};
|
||||
|
||||
// Send an email to the removed user with an optional message from the leader
|
||||
function _sendMessageToRemoved (group, removedUser, message) {
|
||||
function _sendMessageToRemoved (group, removedUser, message, isInGroup) {
|
||||
if (removedUser.preferences.emailNotifications.kickedGroup !== false) {
|
||||
sendTxnEmail(removedUser, `kicked-from-${group.type}`, [
|
||||
let subject = isInGroup ? `kicked-from-${group.type}` : `${group.type}-invite-rescinded`;
|
||||
sendTxnEmail(removedUser, subject, [
|
||||
{name: 'GROUP_NAME', content: group.name},
|
||||
{name: 'MESSAGE', content: message},
|
||||
{name: 'GUILDS_LINK', content: '/#/options/groups/guilds/public'},
|
||||
@@ -575,7 +576,7 @@ api.removeGroupMember = {
|
||||
}
|
||||
|
||||
let message = req.query.message;
|
||||
if (message) _sendMessageToRemoved(group, member, message);
|
||||
_sendMessageToRemoved(group, member, message, isInGroup);
|
||||
|
||||
await Bluebird.all([
|
||||
member.save(),
|
||||
|
||||
Reference in New Issue
Block a user