mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Fix errors
This commit is contained in:
@@ -74,7 +74,8 @@ api.getChat = {
|
|||||||
let group = await Group.getGroup({user, groupId: req.params.groupId, fields: 'chat'});
|
let group = await Group.getGroup({user, groupId: req.params.groupId, fields: 'chat'});
|
||||||
if (!group) throw new NotFound(res.t('groupNotFound'));
|
if (!group) throw new NotFound(res.t('groupNotFound'));
|
||||||
|
|
||||||
res.respond(200, await Group.toJSONCleanChat(group, user).chat);
|
let toJSON = await Group.toJSONCleanChat(group, user);
|
||||||
|
res.respond(200, toJSON.chat);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -194,7 +195,8 @@ api.postChat = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chatUpdated) {
|
if (chatUpdated) {
|
||||||
res.respond(200, {chat: await Group.toJSONCleanChat(savedGroup, user).chat});
|
let toJSON = await Group.toJSONCleanChat(savedGroup, user);
|
||||||
|
res.respond(200, {chat: toJSON.chat});
|
||||||
} else {
|
} else {
|
||||||
res.respond(200, {message: savedGroup.chat[0]});
|
res.respond(200, {message: savedGroup.chat[0]});
|
||||||
}
|
}
|
||||||
@@ -486,7 +488,8 @@ api.deleteChat = {
|
|||||||
).exec();
|
).exec();
|
||||||
|
|
||||||
if (chatUpdated) {
|
if (chatUpdated) {
|
||||||
let chatRes = await Group.toJSONCleanChat(group, user).chat;
|
let toJSON = await Group.toJSONCleanChat(group, user);
|
||||||
|
let chatRes = toJSON.chat;
|
||||||
removeFromArray(chatRes, {id: chatId});
|
removeFromArray(chatRes, {id: chatId});
|
||||||
res.respond(200, chatRes);
|
res.respond(200, chatRes);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -331,9 +331,9 @@ async function translateSystemMessages (group, user) {
|
|||||||
}
|
}
|
||||||
await Bluebird.map(Object.keys(usernames), async (username) => {
|
await Bluebird.map(Object.keys(usernames), async (username) => {
|
||||||
let usr = await User
|
let usr = await User
|
||||||
.findById(username)
|
.findById(username)
|
||||||
.select(nameFields)
|
.select(nameFields)
|
||||||
.exec();
|
.exec();
|
||||||
usernames[username] = usr.profile.name;
|
usernames[username] = usr.profile.name;
|
||||||
});
|
});
|
||||||
for (let i = 0; i < group.chat.length; i++) {
|
for (let i = 0; i < group.chat.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user