From 19b9cb105d49e2a00ae19e3dc1f2d36dc394f148 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 26 Mar 2018 00:19:07 +0900 Subject: Introduce account document to user document An account document is attached to a user document if an account of the user is on the server. It may be missing if the user is on a remote server. --- src/web/app/common/define-widget.ts | 4 ++-- src/web/app/common/mios.ts | 10 +++++----- src/web/app/common/scripts/streaming/drive.ts | 2 +- src/web/app/common/scripts/streaming/home.ts | 4 ++-- .../app/common/scripts/streaming/messaging-index.ts | 2 +- src/web/app/common/scripts/streaming/messaging.ts | 4 ++-- src/web/app/common/scripts/streaming/othello-game.ts | 2 +- src/web/app/common/scripts/streaming/othello.ts | 2 +- src/web/app/common/views/components/signin.vue | 4 ++-- .../app/common/views/components/twitter-setting.vue | 12 ++++++------ src/web/app/common/views/components/uploader.vue | 2 +- src/web/app/desktop/api/update-avatar.ts | 2 +- src/web/app/desktop/api/update-banner.ts | 2 +- src/web/app/desktop/views/components/home.vue | 20 ++++++++++---------- src/web/app/desktop/views/components/post-detail.vue | 2 +- src/web/app/desktop/views/components/posts.post.vue | 4 ++-- .../app/desktop/views/components/settings.2fa.vue | 8 ++++---- .../app/desktop/views/components/settings.api.vue | 2 +- .../desktop/views/components/settings.profile.vue | 8 ++++---- src/web/app/desktop/views/components/settings.vue | 12 ++++++------ src/web/app/desktop/views/components/timeline.vue | 2 +- src/web/app/desktop/views/components/ui.header.vue | 4 ++-- .../desktop/views/components/widget-container.vue | 4 ++-- src/web/app/desktop/views/components/window.vue | 4 ++-- src/web/app/desktop/views/pages/user/user.header.vue | 2 +- src/web/app/desktop/views/pages/user/user.home.vue | 2 +- .../app/desktop/views/pages/user/user.profile.vue | 10 +++++----- src/web/app/mobile/views/components/post-detail.vue | 2 +- src/web/app/mobile/views/components/post-form.vue | 2 +- src/web/app/mobile/views/components/post.vue | 4 ++-- src/web/app/mobile/views/components/ui.header.vue | 4 ++-- src/web/app/mobile/views/pages/home.vue | 20 ++++++++++---------- src/web/app/mobile/views/pages/profile-setting.vue | 4 ++-- src/web/app/mobile/views/pages/user.vue | 10 +++++----- src/web/app/mobile/views/pages/user/home.vue | 2 +- src/web/app/mobile/views/pages/welcome.vue | 4 ++-- 36 files changed, 94 insertions(+), 94 deletions(-) (limited to 'src/web/app') diff --git a/src/web/app/common/define-widget.ts b/src/web/app/common/define-widget.ts index efce7e813c..d8d29873a4 100644 --- a/src/web/app/common/define-widget.ts +++ b/src/web/app/common/define-widget.ts @@ -56,14 +56,14 @@ export default function(data: { id: this.id, data: newProps }).then(() => { - (this as any).os.i.client_settings.mobile_home.find(w => w.id == this.id).data = newProps; + (this as any).os.i.account.client_settings.mobile_home.find(w => w.id == this.id).data = newProps; }); } else { (this as any).api('i/update_home', { id: this.id, data: newProps }).then(() => { - (this as any).os.i.client_settings.home.find(w => w.id == this.id).data = newProps; + (this as any).os.i.account.client_settings.home.find(w => w.id == this.id).data = newProps; }); } }, { diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index 986630da20..1c950c3e79 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -270,7 +270,7 @@ export default class MiOS extends EventEmitter { // Parse response res.json().then(i => { me = i; - me.token = token; + me.account.token = token; done(); }); }) @@ -294,12 +294,12 @@ export default class MiOS extends EventEmitter { const fetched = me => { if (me) { // デフォルトの設定をマージ - me.client_settings = Object.assign({ + me.account.client_settings = Object.assign({ fetchOnScroll: true, showMaps: true, showPostFormOnTopOfTl: false, gradientWindowHeader: false - }, me.client_settings); + }, me.account.client_settings); // ローカルストレージにキャッシュ localStorage.setItem('me', JSON.stringify(me)); @@ -329,7 +329,7 @@ export default class MiOS extends EventEmitter { fetched(cachedMe); // 後から新鮮なデータをフェッチ - fetchme(cachedMe.token, freshData => { + fetchme(cachedMe.account.token, freshData => { merge(cachedMe, freshData); }); } else { @@ -437,7 +437,7 @@ export default class MiOS extends EventEmitter { } // Append a credential - if (this.isSignedIn) (data as any).i = this.i.token; + if (this.isSignedIn) (data as any).i = this.i.account.token; // TODO //const viaStream = localStorage.getItem('enableExperimental') == 'true'; diff --git a/src/web/app/common/scripts/streaming/drive.ts b/src/web/app/common/scripts/streaming/drive.ts index 7ff85b5946..f11573685e 100644 --- a/src/web/app/common/scripts/streaming/drive.ts +++ b/src/web/app/common/scripts/streaming/drive.ts @@ -8,7 +8,7 @@ import MiOS from '../../mios'; export class DriveStream extends Stream { constructor(os: MiOS, me) { super(os, 'drive', { - i: me.token + i: me.account.token }); } } diff --git a/src/web/app/common/scripts/streaming/home.ts b/src/web/app/common/scripts/streaming/home.ts index 533c232449..ffcf6e5360 100644 --- a/src/web/app/common/scripts/streaming/home.ts +++ b/src/web/app/common/scripts/streaming/home.ts @@ -10,13 +10,13 @@ import MiOS from '../../mios'; export class HomeStream extends Stream { constructor(os: MiOS, me) { super(os, '', { - i: me.token + i: me.account.token }); // 最終利用日時を更新するため定期的にaliveメッセージを送信 setInterval(() => { this.send({ type: 'alive' }); - me.last_used_at = new Date(); + me.account.last_used_at = new Date(); }, 1000 * 60); // 自分の情報が更新されたとき diff --git a/src/web/app/common/scripts/streaming/messaging-index.ts b/src/web/app/common/scripts/streaming/messaging-index.ts index 84e2174ec4..24f0ce0c9f 100644 --- a/src/web/app/common/scripts/streaming/messaging-index.ts +++ b/src/web/app/common/scripts/streaming/messaging-index.ts @@ -8,7 +8,7 @@ import MiOS from '../../mios'; export class MessagingIndexStream extends Stream { constructor(os: MiOS, me) { super(os, 'messaging-index', { - i: me.token + i: me.account.token }); } } diff --git a/src/web/app/common/scripts/streaming/messaging.ts b/src/web/app/common/scripts/streaming/messaging.ts index c1b5875cfb..4c593deb31 100644 --- a/src/web/app/common/scripts/streaming/messaging.ts +++ b/src/web/app/common/scripts/streaming/messaging.ts @@ -7,13 +7,13 @@ import MiOS from '../../mios'; export class MessagingStream extends Stream { constructor(os: MiOS, me, otherparty) { super(os, 'messaging', { - i: me.token, + i: me.account.token, otherparty }); (this as any).on('_connected_', () => { this.send({ - i: me.token + i: me.account.token }); }); } diff --git a/src/web/app/common/scripts/streaming/othello-game.ts b/src/web/app/common/scripts/streaming/othello-game.ts index b85af8f72b..f34ef35147 100644 --- a/src/web/app/common/scripts/streaming/othello-game.ts +++ b/src/web/app/common/scripts/streaming/othello-game.ts @@ -4,7 +4,7 @@ import MiOS from '../../mios'; export class OthelloGameStream extends Stream { constructor(os: MiOS, me, game) { super(os, 'othello-game', { - i: me ? me.token : null, + i: me ? me.account.token : null, game: game.id }); } diff --git a/src/web/app/common/scripts/streaming/othello.ts b/src/web/app/common/scripts/streaming/othello.ts index f5d47431cd..8c6f4b9c3c 100644 --- a/src/web/app/common/scripts/streaming/othello.ts +++ b/src/web/app/common/scripts/streaming/othello.ts @@ -5,7 +5,7 @@ import MiOS from '../../mios'; export class OthelloStream extends Stream { constructor(os: MiOS, me) { super(os, 'othello', { - i: me.token + i: me.account.token }); } } diff --git a/src/web/app/common/views/components/signin.vue b/src/web/app/common/views/components/signin.vue index 1738d0df7d..d8b1357764 100644 --- a/src/web/app/common/views/components/signin.vue +++ b/src/web/app/common/views/components/signin.vue @@ -6,7 +6,7 @@ -