fix(3p): bad import, change flag format

This commit is contained in:
SabreCat
2023-04-19 09:33:03 -05:00
parent 86efb02358
commit 3cf5b90f04
5 changed files with 5 additions and 8 deletions

View File

@@ -25,8 +25,6 @@ export const SUPPORTED_SOCIAL_NETWORKS = [
{ key: 'apple', name: 'Apple' }, { key: 'apple', name: 'Apple' },
]; ];
export const OFFICIAL_PLATFORMS = ['habitica-web', 'habitica-ios', 'habitica-android'];
export const GUILDS_PER_PAGE = 30; // number of guilds to return per page when using pagination export const GUILDS_PER_PAGE = 30; // number of guilds to return per page when using pagination
export const PARTY_LIMIT_MEMBERS = 29; export const PARTY_LIMIT_MEMBERS = 29;

View File

@@ -22,7 +22,6 @@ import {
TAVERN_ID, TAVERN_ID,
MAX_MESSAGE_LENGTH, MAX_MESSAGE_LENGTH,
MAX_GIFT_MESSAGE_LENGTH, MAX_GIFT_MESSAGE_LENGTH,
OFFICIAL_PLATFORMS,
} from './constants'; } from './constants';
import content from './content/index'; import content from './content/index';
import * as count from './count'; import * as count from './count';
@@ -125,7 +124,6 @@ api.constants = {
MAX_MESSAGE_LENGTH, MAX_MESSAGE_LENGTH,
MAX_GIFT_MESSAGE_LENGTH, MAX_GIFT_MESSAGE_LENGTH,
MAX_LEVEL_HARD_CAP, MAX_LEVEL_HARD_CAP,
OFFICIAL_PLATFORMS,
}; };
// TODO Move these under api.constants // TODO Move these under api.constants
api.maxLevel = MAX_LEVEL; api.maxLevel = MAX_LEVEL;

View File

@@ -22,8 +22,8 @@ import {
} from '../../libs/email'; } from '../../libs/email';
import * as inboxLib from '../../libs/inbox'; import * as inboxLib from '../../libs/inbox';
import * as userLib from '../../libs/user'; import * as userLib from '../../libs/user';
import { OFFICIAL_PLATFORMS } from '../../../common/script/constants';
const OFFICIAL_PLATFORMS = ['habitica-web', 'habitica-ios', 'habitica-android'];
const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL'); const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL');
const DELETE_CONFIRMATION = 'DELETE'; const DELETE_CONFIRMATION = 'DELETE';

View File

@@ -10,6 +10,7 @@ import gcpStackdriverTracer from '../libs/gcpTraceAgent';
import common from '../../common'; import common from '../../common';
import { getLanguageFromUser } from '../libs/language'; import { getLanguageFromUser } from '../libs/language';
const OFFICIAL_PLATFORMS = ['habitica-web', 'habitica-ios', 'habitica-android'];
const COMMUNITY_MANAGER_EMAIL = nconf.get('EMAILS_COMMUNITY_MANAGER_EMAIL'); const COMMUNITY_MANAGER_EMAIL = nconf.get('EMAILS_COMMUNITY_MANAGER_EMAIL');
const USER_FIELDS_ALWAYS_LOADED = ['_id', 'notifications', 'preferences', 'auth', 'flags', 'permissions']; const USER_FIELDS_ALWAYS_LOADED = ['_id', 'notifications', 'preferences', 'auth', 'flags', 'permissions'];
@@ -91,8 +92,8 @@ export function authWithHeaders (options = {}) {
req.session.userId = user._id; req.session.userId = user._id;
stackdriverTraceUserId(user._id); stackdriverTraceUserId(user._id);
user.auth.timestamps.updated = new Date(); user.auth.timestamps.updated = new Date();
if (common.constants.OFFICIAL_PLATFORMS.indexOf(client) === -1 && !user.flags.thirdPartyTools) { if (OFFICIAL_PLATFORMS.indexOf(client) === -1 && !user.flags.thirdPartyTools) {
User.updateOne(userQuery, { $set: { 'flags.thirdPartyTools': true }}).exec(); User.updateOne(userQuery, { $set: { 'flags.thirdPartyTools': new Date() } }).exec();
} }
return next(); return next();
}) })

View File

@@ -306,7 +306,7 @@ export default new Schema({
cardReceived: { $type: Boolean, default: false }, cardReceived: { $type: Boolean, default: false },
warnedLowHealth: { $type: Boolean, default: false }, warnedLowHealth: { $type: Boolean, default: false },
verifiedUsername: { $type: Boolean, default: false }, verifiedUsername: { $type: Boolean, default: false },
thirdPartyTools: { $type: Boolean, default: false }, thirdPartyTools: { $type: Date },
}, },
history: { history: {