From 75fdc72e222dee612137e4521dab1e44191948bb Mon Sep 17 00:00:00 2001 From: Jiayi Zheng Date: Sun, 4 Dec 2016 18:30:00 +0100 Subject: [PATCH] Implements feature status delete Fixes issue #4 --- src/_variables.scss | 1 + src/components/status/status.js | 10 +++++++++- src/components/status/status.vue | 14 +++++++++++++- src/modules/statuses.js | 11 +++++++++++ src/services/api/api.service.js | 9 +++++++++ test/unit/specs/modules/statuses.spec.js | 5 +++++ 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/_variables.scss b/src/_variables.scss index c317fd3240..d2b7065d20 100644 --- a/src/_variables.scss +++ b/src/_variables.scss @@ -3,4 +3,5 @@ $main-background: white; $darkened-background: whitesmoke; $green: #0fa00f; $blue: #0095ff; +$red: #ff0000; diff --git a/src/components/status/status.js b/src/components/status/status.js index 0bf2ecdeee..8b2561cfc7 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -20,7 +20,9 @@ const Status = { }, loggedIn () { return !!this.$store.state.users.currentUser - } + }, + deleted () { return this.statusoid.deleted }, + canDelete () { return this.statusoid.user.rights.delete_others_notice || this.statusoid.user.id == this.$store.state.users.currentUser.id } }, components: { Attachment, @@ -31,6 +33,12 @@ const Status = { 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 866328768b..35b381bae2 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -1,5 +1,5 @@