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,
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', {

View file

@ -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
});

View file

@ -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
}
});

View file

@ -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);