mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
19 lines
427 B
JavaScript
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';
|
|
}
|
|
}
|