ショートカットからお気に入りとRenote時にダイアログを表示 (#6921)

* お気に入りとRenote時にダイアログを表示

* Fix error handling

* Fix error handling on renote
This commit is contained in:
kabo2468 2020-12-11 21:22:41 +09:00 committed by GitHub
parent e58dd71829
commit 6848f05ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 1 deletions

View File

@ -33,6 +33,9 @@ addUser: "ユーザーを追加"
favorite: "お気に入り" favorite: "お気に入り"
favorites: "お気に入り" favorites: "お気に入り"
unfavorite: "お気に入り解除" unfavorite: "お気に入り解除"
favorited: "お気に入りに登録しました。"
alreadyFavorited: "既にお気に入りに登録されています。"
cantFavorite: "お気に入りに登録できませんでした。"
pin: "ピン留め" pin: "ピン留め"
unpin: "ピン留め解除" unpin: "ピン留め解除"
copyContent: "内容をコピー" copyContent: "内容をコピー"
@ -87,6 +90,9 @@ followRequestPending: "フォロー許可待ち"
enterEmoji: "絵文字を入力" enterEmoji: "絵文字を入力"
renote: "Renote" renote: "Renote"
unrenote: "Renote解除" unrenote: "Renote解除"
renoted: "Renoteしました。"
cantRenote: "この投稿はRenoteできません。"
cantReRenote: "RenoteをRenoteすることはできません。"
quote: "引用" quote: "引用"
pinnedNote: "ピン留めされたノート" pinnedNote: "ピン留めされたノート"
you: "あなた" you: "あなた"

View File

@ -490,8 +490,25 @@ export default defineComponent({
}, },
renoteDirectly() { renoteDirectly() {
os.api('notes/create', { os.apiWithDialog('notes/create', {
renoteId: this.appearNote.id 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(); pleaseLogin();
os.apiWithDialog('notes/favorites/create', { os.apiWithDialog('notes/favorites/create', {
noteId: this.appearNote.id 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'),
});
}
}); });
}, },