From 66ef9f1328f155d50775d55445522c11cd17fa01 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Mon, 13 Feb 2017 23:22:32 +0100 Subject: Add users muting. --- src/modules/users.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/modules') diff --git a/src/modules/users.js b/src/modules/users.js index 8ba365f3..544ca158 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -1,6 +1,7 @@ import timelineFetcher from '../services/timeline_fetcher/timeline_fetcher.service.js' import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js' import { compact, map, each, find, merge } from 'lodash' +import { set } from 'vue' // TODO: Unify with mergeOrAdd in statuses.js export const mergeOrAdd = (arr, item) => { @@ -18,6 +19,10 @@ export const mergeOrAdd = (arr, item) => { } export const mutations = { + setMuted (state, { user: {id}, muted }) { + const user = find(state.users, {id}) + set(user, 'muted', muted) + }, setCurrentUser (state, user) { state.currentUser = user }, -- cgit v1.2.3-70-g09d2 From 4c12de262ff1ca9cde925195de20158c33f7bad0 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 14 Feb 2017 00:01:50 +0100 Subject: Add muting to statuses. --- src/components/status/status.js | 9 +- src/components/status/status.vue | 115 +++++++++++---------- .../user_card_content/user_card_content.vue | 2 +- src/modules/users.js | 9 ++ 4 files changed, 80 insertions(+), 55 deletions(-) (limited to 'src/modules') 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 @@