From 17d7bf8c7e7ffbe6f7a0ec67ddc69f746f2a9053 Mon Sep 17 00:00:00 2001 From: mei23 Date: Wed, 16 Nov 2022 08:27:13 +0900 Subject: [PATCH] Resolve #4125 --- locales/en-US.yml | 3 ++- locales/ja-JP.yml | 3 ++- src/client/app/common/scripts/note-mixin.ts | 20 +++++++++++++++++++ .../common/views/components/follow-button.vue | 14 +++---------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index b5da0608892..8ba37ee82a4 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -122,6 +122,7 @@ common: noteReactions: "Reacted notes" poll_finished: "Poll finished" flush: "Clear cache" + signinOrUsePostUrl: "To do so, either signin or put the URL into your instance's search box and do it." permissions: "read:account": "View your account information" "write:account": "Edit your account information" @@ -1826,7 +1827,7 @@ common/views/components/follow-button.vue: follow-processing: "Processing" follow-request: "Follow request" remoteFollow: "Remote follow" - remoteFollowMessage: "Enter the following account in the search box of the instance you want to follow and follow.\n```\n{acct}\n```\n\n\nAlternatively, enter the account you want to follow below." + remoteFollowMessage: "Enter the following URL in the search box of the instance you want to follow and follow.\n{acct}" mobile/views/components/note.vue: private: "This post is private" deleted: "This post has been deleted" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 5a5596980fb..8c4b22127ba 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -124,6 +124,7 @@ common: noteReactions: "リアクションした投稿" poll_finished: "アンケートが完了しました" flush: "キャッシュをクリア" + signinOrUsePostUrl: "それをするにはサインインするかURLをあなたのインスタンスの検索ボックスに入れてやっていってください。" permissions: "read:account": "アカウントの情報を見る" @@ -2013,7 +2014,7 @@ common/views/components/follow-button.vue: follow-processing: "フォロー処理中" follow-request: "フォロー申請" remoteFollow: "リモートフォロー" - remoteFollowMessage: "以下のアカウントをフォローしたいインスタンスの検索ボックスに入れてフォローして下さい。\n```\n{acct}\n```\n\n\nまたは、以下にフォローしたいアカウントを入力して下さい。" + remoteFollowMessage: "以下のURLをあなたのインスタンスの検索ボックスに入れてフォローして下さい。\n{acct}" mobile/views/components/note.vue: private: "この投稿は非公開です" diff --git a/src/client/app/common/scripts/note-mixin.ts b/src/client/app/common/scripts/note-mixin.ts index 0a25b0e679e..141cce9a225 100644 --- a/src/client/app/common/scripts/note-mixin.ts +++ b/src/client/app/common/scripts/note-mixin.ts @@ -126,6 +126,11 @@ export default (opts: Opts = {}) => ({ }, reply(viaKeyboard = false) { + if (!this.$store.getters.isSignedIn) { + this.$root.dialog({ type: 'info', text: this.$t('@.signinOrUsePostUrl') }); + return; + } + this.$root.$post({ reply: this.appearNote, animation: !viaKeyboard, @@ -136,6 +141,11 @@ export default (opts: Opts = {}) => ({ }, renote(viaKeyboard = false) { + if (!this.$store.getters.isSignedIn) { + this.$root.dialog({ type: 'info', text: this.$t('@.signinOrUsePostUrl') }); + return; + } + this.$root.$post({ renote: this.appearNote, animation: !viaKeyboard, @@ -152,6 +162,11 @@ export default (opts: Opts = {}) => ({ }, react(viaKeyboard = false) { + if (!this.$store.getters.isSignedIn) { + this.$root.dialog({ type: 'info', text: this.$t('@.signinOrUsePostUrl') }); + return; + } + this.blur(); const w = this.$root.new(MkReactionPicker, { source: this.$refs.reactButton, @@ -208,6 +223,11 @@ export default (opts: Opts = {}) => ({ }, menu(viaKeyboard = false) { + if (!this.$store.getters.isSignedIn) { + this.$root.dialog({ type: 'info', text: this.$t('@.signinOrUsePostUrl') }); + return; + } + if (this.openingMenu) return; this.openingMenu = true; const w = this.$root.new(MkNoteMenu, { diff --git a/src/client/app/common/views/components/follow-button.vue b/src/client/app/common/views/components/follow-button.vue index 0c9f482c2c6..a08ce82785f 100644 --- a/src/client/app/common/views/components/follow-button.vue +++ b/src/client/app/common/views/components/follow-button.vue @@ -97,20 +97,12 @@ export default Vue.extend({ try { if (!this.$store.getters.isSignedIn) { - const { canceled, result: acct } = await this.$root.dialog({ + const uri = `${url}/@${this.user.username}`; + await this.$root.dialog({ type: 'info', - text: this.$t('remoteFollowMessage', { acct: `@${this.user.username}@${host}` }), - input: { - placeholder: 'user@example.com', - } + text: this.$t('message', { acct: `[${uri}](${uri})` }), }); - if (canceled || !acct) return; - - const res = await this.$root.api('ap/interact', { acct }); - - const template = res.template as string; - location.href = template.replace('{uri}', `${url}/users/${this.user.id}`); return; }