mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
fix tests failures (#8422)
* fix tests failures * make sure _meta is not public * fix typo * fix typo
This commit is contained in:
@@ -268,12 +268,14 @@ schema.statics.getGroups = async function getGroups (options = {}) {
|
||||
// When converting to json remove chat messages with more than 1 flag and remove all flags info
|
||||
// unless the user is an admin
|
||||
// Not putting into toJSON because there we can't access user
|
||||
// It also removes the _meta field that can be stored inside a chat message
|
||||
schema.statics.toJSONCleanChat = function groupToJSONCleanChat (group, user) {
|
||||
let toJSON = group.toJSON();
|
||||
|
||||
if (!user.contributor.admin) {
|
||||
_.remove(toJSON.chat, chatMsg => {
|
||||
chatMsg.flags = {};
|
||||
if (chatMsg._meta) chatMsg._meta = undefined;
|
||||
return chatMsg.flagCount >= 2;
|
||||
});
|
||||
}
|
||||
@@ -391,6 +393,9 @@ export function chatDefaults (msg, user) {
|
||||
|
||||
schema.methods.sendChat = function sendChat (message, user, metaData) {
|
||||
let newMessage = chatDefaults(message, user);
|
||||
|
||||
// Optional data stored in the chat message but not returned
|
||||
// to the users that can be stored for debugging purposes
|
||||
if (metaData) {
|
||||
newMessage._meta = metaData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user