This commit is contained in:
syuilo 2018-03-30 21:31:51 +09:00
parent 1af9efe54e
commit 616408f36e
4 changed files with 15 additions and 14 deletions

View File

@ -56,7 +56,7 @@ export default function<T extends object>(data: {
id: this.id, id: this.id,
data: newProps data: newProps
}).then(() => { }).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 { } else {
(this as any).api('i/update_home', { (this as any).api('i/update_home', {

View File

@ -82,8 +82,8 @@ export default Vue.extend({
}; };
}, },
created() { created() {
if ((this as any).os.i.account.clientSettings.mobile_home == null) { if ((this as any).os.i.account.clientSettings.mobileHome == null) {
Vue.set((this as any).os.i.account.clientSettings, 'mobile_home', [{ Vue.set((this as any).os.i.account.clientSettings, 'mobileHome', [{
name: 'calendar', name: 'calendar',
id: 'a', data: {} id: 'a', data: {}
}, { }, {
@ -105,14 +105,14 @@ export default Vue.extend({
name: 'version', name: 'version',
id: 'g', data: {} 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(); this.saveHome();
} else { } 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.$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 deep: true
}); });
@ -157,15 +157,15 @@ export default Vue.extend({
}, },
onHomeUpdated(data) { onHomeUpdated(data) {
if (data.home) { 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; this.widgets = data.home;
} else { } 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) { if (w != null) {
w.data = data.data; w.data = data.data;
this.$refs[w.id][0].preventSave = true; this.$refs[w.id][0].preventSave = true;
this.$refs[w.id][0].props = w.data; 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(); this.saveHome();
}, },
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', { (this as any).api('i/update_mobile_home', {
home: this.widgets home: this.widgets
}); });

View File

@ -25,7 +25,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
if (home) { if (home) {
await User.update(user._id, { await User.update(user._id, {
$set: { $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 { } else {
if (id == null && data == null) return rej('you need to set id and data params if home param unset'); 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); const widget = _home.find(w => w.id == id);
if (widget == null) return rej('widget not found'); 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, { await User.update(user._id, {
$set: { $set: {
'account.clientSettings.mobile_home': _home 'account.clientSettings.mobileHome': _home
} }
}); });

View File

@ -227,6 +227,7 @@ db.users.update({}, {
'account.twitter.access_token_secret': '', 'account.twitter.access_token_secret': '',
'account.twitter.user_id': '', 'account.twitter.user_id': '',
'account.twitter.screen_name': '', 'account.twitter.screen_name': '',
'account.line.user_id': '' 'account.line.user_id': '',
'account.client_settings.mobile_home': ''
} }
}, false, true); }, false, true);