From a0f8b715aa2811393b9bccc36ec13742618d3a7c Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Tue, 17 May 2016 22:49:31 +0200 Subject: [PATCH] v3: move TAVERN_ID to common code --- common/script/constants.js | 1 + common/script/index.js | 4 +++- website/client/js/app.js | 2 +- website/server/models/group.js | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/script/constants.js b/common/script/constants.js index 2dc8663091..040b968f8f 100644 --- a/common/script/constants.js +++ b/common/script/constants.js @@ -2,3 +2,4 @@ export const MAX_HEALTH = 50; export const MAX_LEVEL = 100; export const MAX_STAT_POINTS = MAX_LEVEL; export const ATTRIBUTES = ['str', 'int', 'per', 'con']; +export const TAVERN_ID = '00000000-0000-4000-A000-000000000000'; diff --git a/common/script/index.js b/common/script/index.js index e3a0e0a0de..50b01bf762 100644 --- a/common/script/index.js +++ b/common/script/index.js @@ -17,15 +17,17 @@ import { shouldDo, daysSince } from './cron'; api.shouldDo = shouldDo; api.daysSince = daysSince; -// TODO under api.constants? +// TODO under api.constants? and capitalize exported names too import { MAX_HEALTH, MAX_LEVEL, MAX_STAT_POINTS, + TAVERN_ID, } from './constants'; api.maxLevel = MAX_LEVEL; api.maxHealth = MAX_HEALTH; api.maxStatPoints = MAX_STAT_POINTS; +api.TAVERN_ID = TAVERN_ID; // TODO under api.libs.statHelpers? import * as statHelpers from './statHelpers'; diff --git a/website/client/js/app.js b/website/client/js/app.js index bcd0da6cc6..86801e6777 100644 --- a/website/client/js/app.js +++ b/website/client/js/app.js @@ -26,7 +26,7 @@ window.habitrpg = angular.module('habitrpg', .constant("STORAGE_USER_ID", 'habitrpg-user') .constant("STORAGE_SETTINGS_ID", 'habit-mobile-settings') .constant("MOBILE_APP", false) - .constant("TAVERN_ID", '00000000-0000-4000-A000-000000000000') + .constant("TAVERN_ID", window.habitrpgShared.TAVERN_ID) //.constant("STORAGE_GROUPS_ID", "") // if we decide to take groups offline .config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'STORAGE_SETTINGS_ID', diff --git a/website/server/models/group.js b/website/server/models/group.js index d22e63cf70..53305d94b9 100644 --- a/website/server/models/group.js +++ b/website/server/models/group.js @@ -23,7 +23,7 @@ const questScrolls = shared.content.quests; const Schema = mongoose.Schema; export const INVITES_LIMIT = 100; -export const TAVERN_ID = '00000000-0000-4000-A000-000000000000'; +export const TAVERN_ID = shared.TAVERN_ID; // NOTE once Firebase is enabled any change to groups' members in MongoDB will have to be run through the API // changes made directly to the db will cause Firebase to get out of sync