diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-06 08:35:25 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-06 08:35:25 +0900 |
| commit | e515276e15fdf46a1756aa321701faf0b8d09854 (patch) | |
| tree | e61267f45993f635aae7d9a58b4dce068f5022db /src | |
| parent | #1189 (diff) | |
| download | misskey-e515276e15fdf46a1756aa321701faf0b8d09854.tar.gz misskey-e515276e15fdf46a1756aa321701faf0b8d09854.tar.bz2 misskey-e515276e15fdf46a1756aa321701faf0b8d09854.zip | |
nanka iroiro
Closes #1188
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/models/user.ts | 2 | ||||
| -rw-r--r-- | src/api/private/signup.ts | 3 | ||||
| -rw-r--r-- | src/web/app/common/mios.ts | 10 | ||||
| -rw-r--r-- | src/web/app/common/scripts/streaming/home-stream.ts | 7 | ||||
| -rw-r--r-- | src/web/app/desktop/views/components/post-detail.vue | 26 | ||||
| -rw-r--r-- | src/web/app/desktop/views/components/posts.post.vue | 26 | ||||
| -rw-r--r-- | src/web/app/desktop/views/components/settings.vue | 29 | ||||
| -rw-r--r-- | src/web/app/mobile/views/components/post-detail.vue | 26 | ||||
| -rw-r--r-- | src/web/app/mobile/views/components/post.vue | 26 |
9 files changed, 92 insertions, 63 deletions
diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 2fea0566ba..ba2765c793 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -118,7 +118,6 @@ export const pack = ( let _user: any; const fields = opts.detail ? { - settings: false } : { settings: false, client_settings: false, @@ -173,6 +172,7 @@ export const pack = ( // Visible via only the official client if (!opts.includeSecrets) { delete _user.email; + delete _user.settings; delete _user.client_settings; } diff --git a/src/api/private/signup.ts b/src/api/private/signup.ts index 1e3e9fb45f..3df00ae426 100644 --- a/src/api/private/signup.ts +++ b/src/api/private/signup.ts @@ -136,8 +136,7 @@ export default async (req: express.Request, res: express.Response) => { auto_watch: true }, client_settings: { - home: homeData, - show_donation: false + home: homeData } }); 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); }); // トークンが再生成されたとき diff --git a/src/web/app/desktop/views/components/post-detail.vue b/src/web/app/desktop/views/components/post-detail.vue index e33120c7c0..e454c28702 100644 --- a/src/web/app/desktop/views/components/post-detail.vue +++ b/src/web/app/desktop/views/components/post-detail.vue @@ -148,17 +148,20 @@ export default Vue.extend({ // Draw map if (this.p.geo) { - (this as any).os.getGoogleMaps().then(maps => { - const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); - const map = new maps.Map(this.$refs.map, { - center: uluru, - zoom: 15 + const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true; + if (shouldShowMap) { + (this as any).os.getGoogleMaps().then(maps => { + const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); + const map = new maps.Map(this.$refs.map, { + center: uluru, + zoom: 15 + }); + new maps.Marker({ + position: uluru, + map: map + }); }); - new maps.Marker({ - position: uluru, - map: map - }); - }); + } } }, methods: { @@ -348,6 +351,9 @@ export default Vue.extend({ width 100% height 300px + &:empty + display none + > .mk-url-preview margin-top 8px diff --git a/src/web/app/desktop/views/components/posts.post.vue b/src/web/app/desktop/views/components/posts.post.vue index b88f016ad1..1a5f7c3b09 100644 --- a/src/web/app/desktop/views/components/posts.post.vue +++ b/src/web/app/desktop/views/components/posts.post.vue @@ -162,17 +162,20 @@ export default Vue.extend({ // Draw map if (this.p.geo) { - (this as any).os.getGoogleMaps().then(maps => { - const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); - const map = new maps.Map(this.$refs.map, { - center: uluru, - zoom: 15 + const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true; + if (shouldShowMap) { + (this as any).os.getGoogleMaps().then(maps => { + const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); + const map = new maps.Map(this.$refs.map, { + center: uluru, + zoom: 15 + }); + new maps.Marker({ + position: uluru, + map: map + }); }); - new maps.Marker({ - position: uluru, - map: map - }); - }); + } } }, beforeDestroy() { @@ -467,6 +470,9 @@ export default Vue.extend({ width 100% height 300px + &:empty + display none + > .tags margin 4px 0 0 0 diff --git a/src/web/app/desktop/views/components/settings.vue b/src/web/app/desktop/views/components/settings.vue index 3278efb9ca..524e055c3a 100644 --- a/src/web/app/desktop/views/components/settings.vue +++ b/src/web/app/desktop/views/components/settings.vue @@ -20,7 +20,7 @@ <section class="web" v-show="page == 'web'"> <h1>動作</h1> - <mk-switch v-model="fetchOnScroll" @change="onChangeFetchOnScroll" text="スクロールで自動読み込み"> + <mk-switch v-model="os.i.client_settings.fetchOnScroll" @change="onChangeFetchOnScroll" text="スクロールで自動読み込み"> <span>ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます。</span> </mk-switch> </section> @@ -31,6 +31,9 @@ <button class="ui button" @click="customizeHome">ホームをカスタマイズ</button> </div> <mk-switch v-model="os.i.client_settings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/> + <mk-switch v-model="os.i.client_settings.showMaps" @change="onChangeShowMaps" text="マップの自動展開"> + <span>位置情報が添付された投稿のマップを自動的に展開します。</span> + </mk-switch> </section> <section class="web" v-show="page == 'web'"> @@ -71,7 +74,7 @@ <section class="notification" v-show="page == 'notification'"> <h1>通知</h1> - <mk-switch v-model="autoWatch" @change="onChangeAutoWatch" text="投稿の自動ウォッチ"> + <mk-switch v-model="os.i.settings.auto_watch" @change="onChangeAutoWatch" text="投稿の自動ウォッチ"> <span>リアクションしたり返信したりした投稿に関する通知を自動的に受け取るようにします。</span> </mk-switch> </section> @@ -193,8 +196,6 @@ export default Vue.extend({ version, latestVersion: undefined, checkingForUpdate: false, - fetchOnScroll: true, - autoWatch: true, enableSounds: localStorage.getItem('enableSounds') == 'true', lang: localStorage.getItem('lang') || '', preventUpdate: localStorage.getItem('preventUpdate') == 'true', @@ -228,20 +229,6 @@ export default Vue.extend({ (this as any).os.getMeta().then(meta => { this.meta = meta; }); - - if ((this as any).os.i.settings.auto_watch != null) { - this.autoWatch = (this as any).os.i.settings.auto_watch; - this.$watch('os.i.settings.auto_watch', v => { - this.autoWatch = v; - }); - } - - if ((this as any).os.i.client_settings.fetchOnScroll != null) { - this.fetchOnScroll = (this as any).os.i.client_settings.fetchOnScroll; - this.$watch('os.i.client_settings.fetchOnScroll', v => { - this.fetchOnScroll = v; - }); - } }, methods: { customizeHome() { @@ -265,6 +252,12 @@ export default Vue.extend({ value: v }); }, + onChangeShowMaps(v) { + (this as any).api('i/update_client_setting', { + name: 'showMaps', + value: v + }); + }, onChangeDisableViaMobile(v) { (this as any).api('i/update_client_setting', { name: 'disableViaMobile', diff --git a/src/web/app/mobile/views/components/post-detail.vue b/src/web/app/mobile/views/components/post-detail.vue index bf8ce4f6fa..d51bfbc0e6 100644 --- a/src/web/app/mobile/views/components/post-detail.vue +++ b/src/web/app/mobile/views/components/post-detail.vue @@ -144,17 +144,20 @@ export default Vue.extend({ // Draw map if (this.p.geo) { - (this as any).os.getGoogleMaps().then(maps => { - const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); - const map = new maps.Map(this.$refs.map, { - center: uluru, - zoom: 15 + const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true; + if (shouldShowMap) { + (this as any).os.getGoogleMaps().then(maps => { + const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); + const map = new maps.Map(this.$refs.map, { + center: uluru, + zoom: 15 + }); + new maps.Marker({ + position: uluru, + map: map + }); }); - new maps.Marker({ - position: uluru, - map: map - }); - }); + } } }, methods: { @@ -349,6 +352,9 @@ export default Vue.extend({ width 100% height 200px + &:empty + display none + > .mk-url-preview margin-top 8px diff --git a/src/web/app/mobile/views/components/post.vue b/src/web/app/mobile/views/components/post.vue index 390c6396f2..3b31b827f6 100644 --- a/src/web/app/mobile/views/components/post.vue +++ b/src/web/app/mobile/views/components/post.vue @@ -137,17 +137,20 @@ export default Vue.extend({ // Draw map if (this.p.geo) { - (this as any).os.getGoogleMaps().then(maps => { - const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); - const map = new maps.Map(this.$refs.map, { - center: uluru, - zoom: 15 + const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true; + if (shouldShowMap) { + (this as any).os.getGoogleMaps().then(maps => { + const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude); + const map = new maps.Map(this.$refs.map, { + center: uluru, + zoom: 15 + }); + new maps.Marker({ + position: uluru, + map: map + }); }); - new maps.Marker({ - position: uluru, - map: map - }); - }); + } } }, beforeDestroy() { @@ -448,6 +451,9 @@ export default Vue.extend({ width 100% height 200px + &:empty + display none + > .app font-size 12px color #ccc |