diff --git a/package.json b/package.json
index bc49382823..4afc84f3e8 100644
--- a/package.json
+++ b/package.json
@@ -144,6 +144,7 @@
"node-sass": "^4.7.2",
"node-sass-json-importer": "^3.1.3",
"nprogress": "0.2.0",
+ "object-assign-deep": "^0.3.1",
"on-build-webpack": "^0.1.0",
"os-utils": "0.0.14",
"progress-bar-webpack-plugin": "^1.11.0",
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 @@
動作
-
+
ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます。
@@ -31,6 +31,9 @@
+
+ 位置情報が添付された投稿のマップを自動的に展開します。
+
@@ -71,7 +74,7 @@
通知
-
+
リアクションしたり返信したりした投稿に関する通知を自動的に受け取るようにします。
@@ -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