mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Chat flag inbox (#9761)
* Refactored chat reporting * Added inbox flag chat * Added flag chat to inbox * Added you have flagged message
This commit is contained in:
18
website/server/libs/chat.js
Normal file
18
website/server/libs/chat.js
Normal file
@@ -0,0 +1,18 @@
|
||||
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';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user