From 1c4e1af7c3951bf935f7d9e7ce607a77faabe441 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 25 Aug 2019 16:12:01 +0900 Subject: [PATCH] Improve post form (#5326) * Improve post form * Remove local icon from button --- locales/ja-JP.yml | 1 + src/client/app/common/scripts/post-form.ts | 21 ++++--- .../desktop/views/components/post-form.vue | 54 +++++++++++++----- .../app/mobile/views/components/post-form.vue | 55 ++++++++++++++----- 4 files changed, 96 insertions(+), 35 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 107e6dbf1..5a1d8d707 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -139,6 +139,7 @@ common: geolocation-alert: "お使いの端末は位置情報に対応していません" error: "エラー" enter-username: "ユーザー名を入力してください" + specified-recipient: "宛先" add-visible-user: "ユーザーを追加" cw-placeholder: "内容への注釈 (オプション)" username-prompt: "ユーザー名を入力してください" diff --git a/src/client/app/common/scripts/post-form.ts b/src/client/app/common/scripts/post-form.ts index 2b591ac65..9b155f7fc 100644 --- a/src/client/app/common/scripts/post-form.ts +++ b/src/client/app/common/scripts/post-form.ts @@ -153,6 +153,10 @@ export default (opts) => ({ // デフォルト公開範囲 this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility); + if (this.reply && this.reply.localOnly) { + this.localOnly = true; + } + // 公開以外へのリプライ時は元の公開範囲を引き継ぐ if (this.reply && ['home', 'followers', 'specified'].includes(this.reply.visibility)) { this.visibility = this.reply.visibility; @@ -162,13 +166,13 @@ export default (opts) => ({ }).then(users => { this.visibleUsers.push(...users); }); - } - } - if (this.reply && this.reply.userId !== this.$store.state.i.id) { - this.$root.api('users/show', { userId: this.reply.userId }).then(user => { - this.visibleUsers.push(user); - }); + if (this.reply.userId !== this.$store.state.i.id) { + this.$root.api('users/show', { userId: this.reply.userId }).then(user => { + this.visibleUsers.push(user); + }); + } + } } // keep cw when reply @@ -199,8 +203,9 @@ export default (opts) => ({ this.$emit('change-attached-files', this.files); } } + + // 削除して編集 if (this.initialNote) { - // 削除して編集 const init = this.initialNote; this.text = init.text ? init.text : ''; this.files = init.files; @@ -318,7 +323,7 @@ export default (opts) => ({ setVisibility() { const w = this.$root.new(MkVisibilityChooser, { source: this.$refs.visibilityButton, - currentVisibility: this.visibility + currentVisibility: this.localOnly ? `local-${this.visibility}` : this.visibility }); w.$once('chosen', v => { this.applyVisibility(v); diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 5ce5eba73..b9c0624bd 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -10,14 +10,18 @@ {{ $t('@.post-form.recent-tags') }}: #{{ tag }} -
{{ $t('@.post-form.quote-attached') }} [x]
-
- - [x] - - {{ $t('@.post-form.add-visible-user') }} +
{{ $t('@.post-form.quote-attached') }}
+
+ {{ $t('@.post-form.specified-recipient') }} +
+ + + + + +
-
{{ $t('@.post-form.local-only-message') }}
+
{{ $t('@.post-form.local-only-message') }}
@@ -145,13 +148,37 @@ export default Vue.extend({ margin 0 0 8px 0 color var(--primary) - > .visibleUsers - margin 5px - font-size 14px + > button + padding 4px 8px + color var(--primaryAlpha04) - > span - margin-right 16px - color var(--text) + &:hover + color var(--primaryAlpha06) + + &:active + color var(--primaryDarken30) + + > .to-specified + margin 0 0 8px 0 + color var(--primary) + + > .visibleUsers + display inline + top -1px + font-size 14px + + > span + margin-left 14px + + > button + padding 4px 8px + color var(--primaryAlpha04) + + &:hover + color var(--primaryAlpha06) + + &:active + color var(--primaryDarken30) > .local-only margin 0 0 8px 0