From 938f1579156e700b7c2fa7aabc285bc85fc4766c Mon Sep 17 00:00:00 2001 From: kabo2468 <28654659+kabo2468@users.noreply.github.com> Date: Fri, 11 Dec 2020 21:22:41 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=BC=E3=83=88=E3=82=AB?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=8B=E3=82=89=E3=81=8A=E6=B0=97=E3=81=AB?= =?UTF-8?q?=E5=85=A5=E3=82=8A=E3=81=A8Renote=E6=99=82=E3=81=AB=E3=83=80?= =?UTF-8?q?=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=20(#6921)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * お気に入りとRenote時にダイアログを表示 * Fix error handling * Fix error handling on renote --- locales/ja-JP.yml | 6 ++++++ src/client/components/note.vue | 36 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 04dec100f..5af946298 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -33,6 +33,9 @@ addUser: "ユーザーを追加" favorite: "お気に入り" favorites: "お気に入り" unfavorite: "お気に入り解除" +favorited: "お気に入りに登録しました。" +alreadyFavorited: "既にお気に入りに登録されています。" +cantFavorite: "お気に入りに登録できませんでした。" pin: "ピン留め" unpin: "ピン留め解除" copyContent: "内容をコピー" @@ -87,6 +90,9 @@ followRequestPending: "フォロー許可待ち" enterEmoji: "絵文字を入力" renote: "Renote" unrenote: "Renote解除" +renoted: "Renoteしました。" +cantRenote: "この投稿はRenoteできません。" +cantReRenote: "RenoteをRenoteすることはできません。" quote: "引用" pinnedNote: "ピン留めされたノート" you: "あなた" diff --git a/src/client/components/note.vue b/src/client/components/note.vue index 071acf7c9..a16fb6e16 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -490,8 +490,25 @@ export default defineComponent({ }, renoteDirectly() { - os.api('notes/create', { + os.apiWithDialog('notes/create', { renoteId: this.appearNote.id + }, undefined, (res: any) => { + os.dialog({ + type: 'success', + text: this.$t('renoted'), + }); + }, (e: Error) => { + if (e.id === 'b5c90186-4ab0-49c8-9bba-a1f76c282ba4') { + os.dialog({ + type: 'error', + text: this.$t('cantRenote'), + }); + } else if (e.id === 'fd4cc33e-2a37-48dd-99cc-9b806eb2031a') { + os.dialog({ + type: 'error', + text: this.$t('cantReRenote'), + }); + } }); }, @@ -533,6 +550,23 @@ export default defineComponent({ pleaseLogin(); os.apiWithDialog('notes/favorites/create', { noteId: this.appearNote.id + }, undefined, (res: any) => { + os.dialog({ + type: 'success', + text: this.$t('favorited'), + }); + }, (e: Error) => { + if (e.id === 'a402c12b-34dd-41d2-97d8-4d2ffd96a1a6') { + os.dialog({ + type: 'error', + text: this.$t('alreadyFavorited'), + }); + } else if (e.id === '6dd26674-e060-4816-909a-45ba3f4da458') { + os.dialog({ + type: 'error', + text: this.$t('cantFavorite'), + }); + } }); },