Skip to content

Commit

Permalink
編集投稿完了後に削除するように
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Aug 8, 2019
1 parent add1ecb commit bc0af3e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ common/views/components/note-menu.vue:
unpin: "Unpin"
delete: "Delete"
delete-confirm: "Are you sure you want to delete this post?"
edit: "Edit"
edit-confirm: "Are you sure you want to edit this post? You will lose all reactions, renotes and replies to it."
delete-and-edit: "Delete and edit"
delete-and-edit-confirm: "Are you sure you want to delete this post for editing? The reactions and renotes are also deleted."
remote: "Show original note"
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ common/views/components/note-menu.vue:
unpin: "ピン留め解除"
delete: "削除"
delete-confirm: "この投稿を削除しますか?"
edit: "編集"
edit-confirm: "この投稿を編集しますか?この投稿へのリアクション、Renote、返信も全て削除されます。"
delete-and-edit: "削除して編集"
delete-and-edit-confirm: "この投稿を削除してもう一度編集しますか?この投稿へのリアクション、リノート、返信も全て削除されます。"
remote: "投稿元で見る"
Expand Down
18 changes: 16 additions & 2 deletions src/client/app/common/views/components/note-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export default Vue.extend({
},
this.note.userId == this.$store.state.i.id ? {
icon: ['fa', 'undo-alt'],
text: this.$t('delete-and-edit'),
action: this.deleteAndEdit
text: this.$t('edit'),
action: this.edit
} : undefined]
: []
)]
Expand Down Expand Up @@ -176,6 +176,20 @@ export default Vue.extend({
});
},
edit() {
this.$root.dialog({
type: 'warning',
text: this.$t('edit-confirm'),
showCancelButton: true
}).then(({ canceled }) => {
if (canceled) return;
this.$post({
initialNote: Object.assign({ _edit: true }, this.note),
reply: this.note.reply,
});
});
},
deleteAndEdit() {
this.$root.dialog({
type: 'warning',
Expand Down
7 changes: 7 additions & 0 deletions src/client/app/desktop/views/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,13 @@ export default Vue.extend({
this.preview = data.createdNote;
return;
}
if (this.initialNote && this.initialNote._edit) {
this.$root.api('notes/delete', {
noteId: this.initialNote.id
});
}
this.clear();
this.deleteDraft();
this.$emit('posted');
Expand Down
6 changes: 6 additions & 0 deletions src/client/app/mobile/views/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ export default Vue.extend({
localOnly,
viaMobile: viaMobile
}).then(data => {
if (this.initialNote && this.initialNote._edit) {
this.$root.api('notes/delete', {
noteId: this.initialNote.id
});
}
this.$emit('posted');
}).catch(err => {
this.posting = false;
Expand Down

0 comments on commit bc0af3e

Please sign in to comment.