mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Add support for getting chat limit from database (#14392)
* Add support for getting chat limit from database * fix lint error
This commit is contained in:
@@ -10,7 +10,12 @@ const questScrolls = shared.content.quests;
|
||||
|
||||
// @TODO: Don't use this method when the group can be saved.
|
||||
export async function getGroupChat (group) {
|
||||
const maxChatCount = group.hasActiveGroupPlan() ? MAX_SUBBED_GROUP_CHAT_COUNT : MAX_CHAT_COUNT;
|
||||
let maxChatCount = MAX_CHAT_COUNT;
|
||||
if (group.chatLimitCount && group.chatLimitCount >= MAX_CHAT_COUNT) {
|
||||
maxChatCount = group.chatLimitCount;
|
||||
} else if (group.hasActiveGroupPlan()) {
|
||||
maxChatCount = MAX_SUBBED_GROUP_CHAT_COUNT;
|
||||
}
|
||||
|
||||
const groupChat = await Chat.find({ groupId: group._id })
|
||||
.limit(maxChatCount)
|
||||
|
||||
@@ -91,6 +91,7 @@ export const schema = new Schema({
|
||||
},
|
||||
memberCount: { $type: Number, default: 1 },
|
||||
challengeCount: { $type: Number, default: 0 },
|
||||
chatLimitCount: { $type: Number },
|
||||
balance: { $type: Number, default: 0 },
|
||||
logo: String,
|
||||
leaderMessage: String,
|
||||
|
||||
Reference in New Issue
Block a user