From e515276e15fdf46a1756aa321701faf0b8d09854 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 6 Mar 2018 08:35:25 +0900 Subject: nanka iroiro Closes #1188 --- src/web/app/common/mios.ts | 10 +++++++++- src/web/app/common/scripts/streaming/home-stream.ts | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/web/app/common') diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index da1d9746a1..bbe28960fd 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -1,5 +1,6 @@ import Vue from 'vue'; import { EventEmitter } from 'eventemitter3'; +import * as merge from 'object-assign-deep'; import { host, apiUrl, swPublickey, version, lang, googleMapsApiKey } from '../config'; import Progress from './scripts/loading'; @@ -284,6 +285,13 @@ export default class MiOS extends EventEmitter { // フェッチが完了したとき const fetched = me => { if (me) { + // デフォルトの設定をマージ + me.client_settings = Object.assign({ + fetchOnScroll: true, + showMaps: true, + showPostFormOnTopOfTl: false + }, me.client_settings); + // ローカルストレージにキャッシュ localStorage.setItem('me', JSON.stringify(me)); } @@ -313,7 +321,7 @@ export default class MiOS extends EventEmitter { // 後から新鮮なデータをフェッチ fetchme(cachedMe.token, freshData => { - Object.assign(cachedMe, freshData); + merge(cachedMe, freshData); }); } else { // Get token from cookie diff --git a/src/web/app/common/scripts/streaming/home-stream.ts b/src/web/app/common/scripts/streaming/home-stream.ts index 57bf0ec2a6..3516705e22 100644 --- a/src/web/app/common/scripts/streaming/home-stream.ts +++ b/src/web/app/common/scripts/streaming/home-stream.ts @@ -1,3 +1,5 @@ +import * as merge from 'object-assign-deep'; + import Stream from './stream'; import MiOS from '../../mios'; @@ -18,7 +20,10 @@ export default class Connection extends Stream { // 自分の情報が更新されたとき this.on('i_updated', i => { - Object.assign(me, i); + if (os.debug) { + console.log('I updated:', i); + } + merge(me, i); }); // トークンが再生成されたとき -- cgit v1.2.3-freya