From 616408f36e10a6e6409208ed680c30ed0e2b8b34 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 30 Mar 2018 21:31:51 +0900 Subject: [PATCH] oops --- src/client/app/common/define-widget.ts | 2 +- src/client/app/mobile/views/pages/home.vue | 18 +++++++++--------- .../api/endpoints/i/update_mobile_home.ts | 6 +++--- tools/migration/nighthike/4.js | 3 ++- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/client/app/common/define-widget.ts b/src/client/app/common/define-widget.ts index 27db59b5e..9f8dcfc7e 100644 --- a/src/client/app/common/define-widget.ts +++ b/src/client/app/common/define-widget.ts @@ -56,7 +56,7 @@ export default function(data: { id: this.id, data: newProps }).then(() => { - (this as any).os.i.account.clientSettings.mobile_home.find(w => w.id == this.id).data = newProps; + (this as any).os.i.account.clientSettings.mobileHome.find(w => w.id == this.id).data = newProps; }); } else { (this as any).api('i/update_home', { diff --git a/src/client/app/mobile/views/pages/home.vue b/src/client/app/mobile/views/pages/home.vue index be9101aa7..f1f65f90c 100644 --- a/src/client/app/mobile/views/pages/home.vue +++ b/src/client/app/mobile/views/pages/home.vue @@ -82,8 +82,8 @@ export default Vue.extend({ }; }, created() { - if ((this as any).os.i.account.clientSettings.mobile_home == null) { - Vue.set((this as any).os.i.account.clientSettings, 'mobile_home', [{ + if ((this as any).os.i.account.clientSettings.mobileHome == null) { + Vue.set((this as any).os.i.account.clientSettings, 'mobileHome', [{ name: 'calendar', id: 'a', data: {} }, { @@ -105,14 +105,14 @@ export default Vue.extend({ name: 'version', id: 'g', data: {} }]); - this.widgets = (this as any).os.i.account.clientSettings.mobile_home; + this.widgets = (this as any).os.i.account.clientSettings.mobileHome; this.saveHome(); } else { - this.widgets = (this as any).os.i.account.clientSettings.mobile_home; + this.widgets = (this as any).os.i.account.clientSettings.mobileHome; } this.$watch('os.i.account.clientSettings', i => { - this.widgets = (this as any).os.i.account.clientSettings.mobile_home; + this.widgets = (this as any).os.i.account.clientSettings.mobileHome; }, { deep: true }); @@ -157,15 +157,15 @@ export default Vue.extend({ }, onHomeUpdated(data) { if (data.home) { - (this as any).os.i.account.clientSettings.mobile_home = data.home; + (this as any).os.i.account.clientSettings.mobileHome = data.home; this.widgets = data.home; } else { - const w = (this as any).os.i.account.clientSettings.mobile_home.find(w => w.id == data.id); + const w = (this as any).os.i.account.clientSettings.mobileHome.find(w => w.id == data.id); if (w != null) { w.data = data.data; this.$refs[w.id][0].preventSave = true; this.$refs[w.id][0].props = w.data; - this.widgets = (this as any).os.i.account.clientSettings.mobile_home; + this.widgets = (this as any).os.i.account.clientSettings.mobileHome; } } }, @@ -194,7 +194,7 @@ export default Vue.extend({ this.saveHome(); }, saveHome() { - (this as any).os.i.account.clientSettings.mobile_home = this.widgets; + (this as any).os.i.account.clientSettings.mobileHome = this.widgets; (this as any).api('i/update_mobile_home', { home: this.widgets }); diff --git a/src/server/api/endpoints/i/update_mobile_home.ts b/src/server/api/endpoints/i/update_mobile_home.ts index b06ca108a..6f28cebf9 100644 --- a/src/server/api/endpoints/i/update_mobile_home.ts +++ b/src/server/api/endpoints/i/update_mobile_home.ts @@ -25,7 +25,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { if (home) { await User.update(user._id, { $set: { - 'account.clientSettings.mobile_home': home + 'account.clientSettings.mobileHome': home } }); @@ -37,7 +37,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { } else { if (id == null && data == null) return rej('you need to set id and data params if home param unset'); - const _home = user.account.clientSettings.mobile_home || []; + const _home = user.account.clientSettings.mobileHome || []; const widget = _home.find(w => w.id == id); if (widget == null) return rej('widget not found'); @@ -46,7 +46,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - 'account.clientSettings.mobile_home': _home + 'account.clientSettings.mobileHome': _home } }); diff --git a/tools/migration/nighthike/4.js b/tools/migration/nighthike/4.js index 2e252b7f4..f308341f0 100644 --- a/tools/migration/nighthike/4.js +++ b/tools/migration/nighthike/4.js @@ -227,6 +227,7 @@ db.users.update({}, { 'account.twitter.access_token_secret': '', 'account.twitter.user_id': '', 'account.twitter.screen_name': '', - 'account.line.user_id': '' + 'account.line.user_id': '', + 'account.client_settings.mobile_home': '' } }, false, true);