Merge remote-tracking branch 'origin/develop' into negue/ui/setting
This commit is contained in:
@@ -289,8 +289,11 @@ api.updatePassword = {
|
||||
newPassword: {
|
||||
notEmpty: { errorMessage: res.t('missingNewPassword') },
|
||||
isLength: {
|
||||
options: { min: common.constants.MINIMUM_PASSWORD_LENGTH },
|
||||
errorMessage: res.t('minPasswordLength'),
|
||||
options: {
|
||||
min: common.constants.MINIMUM_PASSWORD_LENGTH,
|
||||
max: common.constants.MAXIMUM_PASSWORD_LENGTH,
|
||||
},
|
||||
errorMessage: res.t('passwordIssueLength'),
|
||||
},
|
||||
},
|
||||
confirmPassword: {
|
||||
|
||||
@@ -22,6 +22,7 @@ function _deleteProperties (obj, keysToDelete, platform) {
|
||||
|
||||
function _deleteOtherPlatformsAnswers (faqObject, platform) {
|
||||
const faqCopy = _.cloneDeep(faqObject);
|
||||
_.remove(faqCopy.questions, question => question.exclusions.indexOf(platform) !== -1);
|
||||
const keysToDelete = _.without(['web', 'ios', 'android'], platform);
|
||||
|
||||
_deleteProperties(faqCopy.stillNeedHelp, keysToDelete, platform);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -207,6 +207,13 @@ async function inviteByUserName (username, group, inviter, req, res) {
|
||||
throw new BadRequest(res.t('cannotInviteSelfToGroup'));
|
||||
}
|
||||
|
||||
const objections = inviter.getObjectionsToInteraction('group-invitation', userToInvite);
|
||||
if (objections.length > 0) {
|
||||
throw new NotAuthorized(res.t(
|
||||
objections[0],
|
||||
{ userId: userToInvite._id, username: userToInvite.profile.name },
|
||||
));
|
||||
}
|
||||
return addInvitationToUser(userToInvite, group, inviter, res);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
@@ -871,6 +872,7 @@ function _getUserUpdateForQuestReward (itemToAward, allAwardedItems) {
|
||||
let updates = {
|
||||
$set: {},
|
||||
$inc: {},
|
||||
$pull: {},
|
||||
};
|
||||
const dropK = itemToAward.key;
|
||||
|
||||
@@ -878,6 +880,7 @@ function _getUserUpdateForQuestReward (itemToAward, allAwardedItems) {
|
||||
case 'gear': {
|
||||
// TODO This means they can lose their new gear on death, is that what we want?
|
||||
updates.$set[`items.gear.owned.${dropK}`] = true;
|
||||
updates.$pull.pinnedItems = { path: `gear.flat.${dropK}` };
|
||||
break;
|
||||
}
|
||||
case 'eggs':
|
||||
|
||||
@@ -67,8 +67,11 @@ export function setUserStyles (newMessage, user) {
|
||||
|
||||
if (userCopy.items) {
|
||||
userStyles.items.gear = {};
|
||||
userStyles.items.gear.costume = { ...userCopy.items.gear.costume };
|
||||
userStyles.items.gear.equipped = { ...userCopy.items.gear.equipped };
|
||||
if (userCopy.preferences && userCopy.preferences.costume) {
|
||||
userStyles.items.gear.costume = { ...userCopy.items.gear.costume };
|
||||
} else {
|
||||
userStyles.items.gear.equipped = { ...userCopy.items.gear.equipped };
|
||||
}
|
||||
|
||||
userStyles.items.currentMount = userCopy.items.currentMount;
|
||||
userStyles.items.currentPet = userCopy.items.currentPet;
|
||||
|
||||
@@ -150,10 +150,10 @@ function _setUpNewUser (user) {
|
||||
user.items.quests.dustbunnies = 1;
|
||||
user.purchased.background.violet = true;
|
||||
user.preferences.background = 'violet';
|
||||
if (moment().isBetween('2022-11-22T08:00-05:00', '2022-11-27T20:00-05:00')) {
|
||||
user.migration = '20221122_harvest_feast';
|
||||
user.items.pets['Turkey-Base'] = 5;
|
||||
user.items.currentPet = 'Turkey-Base';
|
||||
if (moment().isBetween('2022-12-27T08:00-05:00', '2023-01-02T20:00-05:00')) {
|
||||
user.migration = '20221227_nye';
|
||||
user.items.gear.owned.head_special_nye = true;
|
||||
user.items.gear.equipped.head = 'head_special_nye';
|
||||
}
|
||||
|
||||
user.markModified('items achievements');
|
||||
|
||||
@@ -152,6 +152,7 @@ export const UserSchema = new Schema({
|
||||
reptacularRumble: Boolean,
|
||||
woodlandWizard: Boolean,
|
||||
boneToPick: Boolean,
|
||||
polarPro: Boolean,
|
||||
// Onboarding Guide
|
||||
createdTask: Boolean,
|
||||
completedTask: Boolean,
|
||||
|
||||
Reference in New Issue
Block a user