Corrected recipient email address in reported PM Slack notification - fixes #12256 (#12838)

* Corrected recipient email address in reported PM Slack notification

Corrected the recipient email address in the Slack notification sent to moderators when a user reports their own private message.

* Installed new dependencies

* Removed personal comments

Co-authored-by: Matteo Pagliazzi <matteopagliazzi@gmail.com>
This commit is contained in:
Sophie Lau
2020-12-14 01:15:19 +08:00
committed by GitHub
parent 4bdaa58592
commit f06fefe9c0
4 changed files with 63 additions and 14 deletions

View File

@@ -31,7 +31,7 @@ export default class InboxChatReporter extends ChatReporter {
if (validationErrors) throw validationErrors;
if (this.user.contributor.admin && this.req.query.userId) {
this.inboxUser = await User.findOne({ _id: this.req.query.userId });
this.inboxUser = await User.findOne({ _id: this.req.query.userId }).exec();
}
const message = await inboxLib.getUserInboxMessage(this.inboxUser, this.req.params.messageId);
@@ -57,7 +57,7 @@ export default class InboxChatReporter extends ChatReporter {
sendTxn(FLAG_REPORT_EMAILS, 'flag-report-to-mods-with-comments', emailVariables);
slack.sendInboxFlagNotification({
authorEmail: this.authorEmail,
messageUserEmail: this.messageUserEmail,
flagger: this.user,
message,
userComment,
@@ -83,7 +83,7 @@ export default class InboxChatReporter extends ChatReporter {
const sendingUser = message.sent ? reporter : messageUser;
const recipient = message.sent ? messageUser : reporter;
this.authorEmail = sendingUser.email;
this.messageUserEmail = message.sent ? recipient.email : sendingUser.email;
return [
...this.createGenericAuthorVariables('AUTHOR', sendingUser),