From 035bdd0279084ae9d7ea358750490b877e8c2ed2 Mon Sep 17 00:00:00 2001 From: Aya Morisawa <AyaMorisawa4869@gmail.com> Date: Fri, 9 Nov 2018 21:10:21 +0900 Subject: [PATCH] Add showVia option (#3182) * Resolve #3160 * Fix bug * Fix bug --- locales/ja-JP.yml | 1 + src/client/app/common/views/components/note-header.vue | 2 +- src/client/app/desktop/views/components/note-detail.vue | 2 +- src/client/app/desktop/views/components/note.vue | 2 +- src/client/app/desktop/views/components/settings.vue | 6 ++++++ src/client/app/mobile/views/components/note.vue | 2 +- src/client/app/mobile/views/pages/settings.vue | 7 +++++++ src/client/app/store.ts | 1 + 8 files changed, 19 insertions(+), 4 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6376eb9647..0edfd1464b 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -120,6 +120,7 @@ common: always-show-nsfw: "常に閲覧注意のメディアを表示する" always-mark-nsfw: "常にメディアを閲覧注意として投稿" show-full-acct: "ユーザー名のホストを省略しない" + show-via: "viaを表示する" reduce-motion: "UIの動きを減らす" this-setting-is-this-device-only: "このデバイスのみ" use-os-default-emojis: "OS標準の絵文字を使用" diff --git a/src/client/app/common/views/components/note-header.vue b/src/client/app/common/views/components/note-header.vue index 8910b43d32..2c7ae0194c 100644 --- a/src/client/app/common/views/components/note-header.vue +++ b/src/client/app/common/views/components/note-header.vue @@ -8,7 +8,7 @@ <span class="username"><mk-acct :user="note.user"/></span> <span class="is-verified" v-if="note.user.isVerified" :title="$t('@.verified-user')"><fa icon="star"/></span> <div class="info"> - <span class="app" v-if="note.app && !mini">via <b>{{ note.app.name }}</b></span> + <span class="app" v-if="note.app && !mini && $store.state.settings.showVia">via <b>{{ note.app.name }}</b></span> <span class="mobile" v-if="note.viaMobile"><fa icon="mobile-alt"/></span> <router-link class="created-at" :to="note | notePage"> <mk-time :time="note.createdAt"/> diff --git a/src/client/app/desktop/views/components/note-detail.vue b/src/client/app/desktop/views/components/note-detail.vue index d097b584f0..698926a3df 100644 --- a/src/client/app/desktop/views/components/note-detail.vue +++ b/src/client/app/desktop/views/components/note-detail.vue @@ -60,7 +60,7 @@ </div> </div> <footer> - <span class="app" v-if="note.app">via <b>{{ note.app.name }}</b></span> + <span class="app" v-if="note.app && $store.state.settings.showVia">via <b>{{ note.app.name }}</b></span> <mk-reactions-viewer :note="p"/> <button class="replyButton" @click="reply" :title="$t('reply')"> <template v-if="p.reply"><fa icon="reply-all"/></template> diff --git a/src/client/app/desktop/views/components/note.vue b/src/client/app/desktop/views/components/note.vue index 499353524c..2b164687eb 100644 --- a/src/client/app/desktop/views/components/note.vue +++ b/src/client/app/desktop/views/components/note.vue @@ -47,7 +47,7 @@ </div> </div> <footer> - <span class="app" v-if="appearNote.app && mini">via <b>{{ appearNote.app.name }}</b></span> + <span class="app" v-if="appearNote.app && mini && $store.state.settings.showVia">via <b>{{ appearNote.app.name }}</b></span> <mk-reactions-viewer :note="appearNote" ref="reactionsViewer"/> <button class="replyButton" @click="reply()" :title="$t('reply')"> <template v-if="appearNote.reply"><fa icon="reply-all"/></template> diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index 7080943da8..7e9e900c6f 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -112,6 +112,7 @@ <ui-switch v-model="reduceMotion">{{ $t('@.reduce-motion') }}</ui-switch> <ui-switch v-model="contrastedAcct">{{ $t('contrasted-acct') }}</ui-switch> <ui-switch v-model="showFullAcct">{{ $t('@.show-full-acct') }}</ui-switch> + <ui-switch v-model="showVia">{{ $t('@.show-via') }}</ui-switch> <ui-switch v-model="useOsDefaultEmojis">{{ $t('@.use-os-default-emojis') }}</ui-switch> <ui-switch v-model="iLikeSushi">{{ $t('@.i-like-sushi') }}</ui-switch> </section> @@ -479,6 +480,11 @@ export default Vue.extend({ set(value) { this.$store.dispatch('settings/set', { key: 'showFullAcct', value }); } }, + showVia: { + get() { return this.$store.state.settings.showVia; }, + set(value) { this.$store.dispatch('settings/set', { key: 'showVia', value }); } + }, + iLikeSushi: { get() { return this.$store.state.settings.iLikeSushi; }, set(value) { this.$store.dispatch('settings/set', { key: 'iLikeSushi', value }); } diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue index 08628da30b..f6b7d39b83 100644 --- a/src/client/app/mobile/views/components/note.vue +++ b/src/client/app/mobile/views/components/note.vue @@ -41,7 +41,7 @@ <a class="location" v-if="appearNote.geo" :href="`https://maps.google.com/maps?q=${appearNote.geo.coordinates[1]},${appearNote.geo.coordinates[0]}`" target="_blank"><fa icon="map-marker-alt"/> {{ $t('location') }}</a> <div class="renote" v-if="appearNote.renote"><mk-note-preview :note="appearNote.renote"/></div> </div> - <span class="app" v-if="appearNote.app">via <b>{{ appearNote.app.name }}</b></span> + <span class="app" v-if="appearNote.app && $store.state.settings.showVia">via <b>{{ appearNote.app.name }}</b></span> </div> <footer> <mk-reactions-viewer :note="appearNote" ref="reactionsViewer"/> diff --git a/src/client/app/mobile/views/pages/settings.vue b/src/client/app/mobile/views/pages/settings.vue index 11fa3c31b1..b480829e79 100644 --- a/src/client/app/mobile/views/pages/settings.vue +++ b/src/client/app/mobile/views/pages/settings.vue @@ -23,6 +23,7 @@ <ui-switch v-model="reduceMotion">{{ $t('@.reduce-motion') }} ({{ $t('@.this-setting-is-this-device-only') }})</ui-switch> <ui-switch v-model="contrastedAcct">{{ $t('contrasted-acct') }}</ui-switch> <ui-switch v-model="showFullAcct">{{ $t('@.show-full-acct') }}</ui-switch> + <ui-switch v-model="showFullVia">{{ $t('@.show-via') }}</ui-switch> <ui-switch v-model="useOsDefaultEmojis">{{ $t('@.use-os-default-emojis') }}</ui-switch> <ui-switch v-model="useOsDefaultEmojis">{{ $t('@.use-os-default-emojis') }}</ui-switch> <ui-switch v-model="iLikeSushi">{{ $t('@.i-like-sushi') }}</ui-switch> @@ -283,6 +284,12 @@ export default Vue.extend({ set(value) { this.$store.dispatch('settings/set', { key: 'showFullAcct', value }); } }, + showVia: { + get() { return this.$store.state.settings.showVia; }, + set(value) { this.$store.dispatch('settings/set', { key: 'showVia', value }); } + }, + + iLikeSushi: { get() { return this.$store.state.settings.iLikeSushi; }, set(value) { this.$store.dispatch('settings/set', { key: 'iLikeSushi', value }); } diff --git a/src/client/app/store.ts b/src/client/app/store.ts index 1108a1c3da..08d5c9b127 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -23,6 +23,7 @@ const defaultSettings = { circleIcons: true, contrastedAcct: true, showFullAcct: false, + showVia: true, showReplyTarget: true, showMyRenotes: true, showRenotedMyNotes: true,