diff --git a/src/components/delete_button/delete_button.js b/src/components/delete_button/delete_button.js new file mode 100644 index 0000000000..726509d055 --- /dev/null +++ b/src/components/delete_button/delete_button.js @@ -0,0 +1,17 @@ +const DeleteButton = { + props: [ 'status' ], + methods: { + deleteStatus () { + const confirmed = confirm('Do you really want to delete this status?') + if (confirmed) { + this.$store.dispatch('deleteStatus', { id: this.status.id }) + } + } + }, + computed: { + currentUser () { return this.$store.state.users.currentUser }, + canDelete () { return this.currentUser.rights.delete_others_notice || this.status.user.id == this.currentUser.id } + } +} + +export default DeleteButton diff --git a/src/components/delete_button/delete_button.vue b/src/components/delete_button/delete_button.vue new file mode 100644 index 0000000000..304f8a6336 --- /dev/null +++ b/src/components/delete_button/delete_button.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/src/components/status/status.js b/src/components/status/status.js index 3245d98b20..2791147853 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -1,6 +1,7 @@ import Attachment from '../attachment/attachment.vue' import FavoriteButton from '../favorite_button/favorite_button.vue' import RetweetButton from '../retweet_button/retweet_button.vue' +import DeleteButton from '../delete_button/delete_button.vue' import PostStatusForm from '../post_status_form/post_status_form.vue' const Status = { @@ -20,25 +21,18 @@ const Status = { }, loggedIn () { return !!this.$store.state.users.currentUser - }, - deleted () { return this.statusoid.deleted }, - canDelete () { return this.statusoid.user.id === this.$store.state.users.currentUser.id } + } }, components: { Attachment, FavoriteButton, RetweetButton, + DeleteButton, PostStatusForm }, methods: { toggleReplying () { this.replying = !this.replying - }, - deleteStatus () { - const confirmed = confirm('Do you really want to delete this status?') - if (confirmed) { - this.$store.dispatch('deleteStatus', { id: this.status.id }) - } } } } diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 6b9bca5b55..4249940738 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -52,11 +52,7 @@ -
- - - -
+ @@ -130,11 +126,4 @@ .status-el:last-child .status { border: none } - - .icon-cancel,.delete-status { - cursor: pointer; - &:hover { - color: $red; - } - }