Files
habitica/website/server/libs/chat.js
Keith Holliday 98d4fb0f34 Chat flag inbox (#9761)
* Refactored chat reporting

* Added inbox flag chat

* Added flag chat to inbox

* Added you have flagged message
2018-01-08 13:13:25 -06:00

19 lines
427 B
JavaScript

import { model as User } from '../models/user';
import { getUserInfo } from './email';
export async function getAuthorEmailFromMessage (message) {
let authorId = message.uuid;
if (authorId === 'system') {
return 'system';
}
let author = await User.findOne({_id: authorId}, {auth: 1}).exec();
if (author) {
return getUserInfo(author, ['email']).email;
} else {
return 'Author Account Deleted';
}
}