From 4c12de262ff1ca9cde925195de20158c33f7bad0 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 14 Feb 2017 00:01:50 +0100 Subject: [PATCH] Add muting to statuses. --- src/components/status/status.js | 9 +- src/components/status/status.vue | 117 ++++++++++-------- .../user_card_content/user_card_content.vue | 2 +- src/modules/users.js | 9 ++ 4 files changed, 81 insertions(+), 56 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index 40589ea5..3d1d50fb 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -11,7 +11,8 @@ const Status = { ], data: () => ({ replying: false, - expanded: false + expanded: false, + unmuted: false }), computed: { retweet () { return !!this.statusoid.retweeted_status }, @@ -25,7 +26,8 @@ const Status = { }, loggedIn () { return !!this.$store.state.users.currentUser - } + }, + muted () { return !this.unmuted && this.status.user.muted } }, components: { Attachment, @@ -40,6 +42,9 @@ const Status = { }, toggleExpanded () { this.$emit('toggleExpanded') + }, + toggleMute () { + this.unmuted = !this.unmuted } } } diff --git a/src/components/status/status.vue b/src/components/status/status.vue index f113fb7e..95abdd5b 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -1,70 +1,78 @@ @@ -128,4 +136,7 @@ padding-right: 1em; border-bottom: 1px solid; } + .muted button { + margin-left: auto; + } diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index b44dcaa9..2c32406b 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -4,7 +4,7 @@
Muted
-
+
diff --git a/src/modules/users.js b/src/modules/users.js index 544ca158..546015ba 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -52,6 +52,15 @@ const users = { const retweetedUsers = compact(map(statuses, 'retweeted_status.user')) store.commit('addNewUsers', users) store.commit('addNewUsers', retweetedUsers) + + // Reconnect users to statuses + each(statuses, (status) => { + status.user = find(store.state.users, status.user) + }) + // Reconnect users to retweets + each(compact(map(statuses, 'retweeted_status')), (status) => { + status.user = find(store.state.users, status.user) + }) }, loginUser (store, userCredentials) { const commit = store.commit