diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/user_card_content/user_card_content.vue | 8 | ||||
| -rw-r--r-- | src/modules/users.js | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index 9a21f404..b44dcaa9 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -3,6 +3,10 @@ <div class="base00-background panel-heading text-center" v-bind:style="style"> <div class='user-info'> <img :src="user.profile_image_url"> + <div v-if='user.muted' class='muteinfo'>Muted</div> + <div class='muteinfo'> + <button @click="toggleMute">Mute/Unmute</button> + </div> <span class="glyphicon glyphicon-user"></span> <div class='user-name'>{{user.name}}</div> <div class='user-screen-name'>@{{user.screen_name}}</div> @@ -70,6 +74,10 @@ const store = this.$store store.state.api.backendInteractor.unfollowUser(this.user.id) .then((unfollowedUser) => store.commit('addNewUsers', [unfollowedUser])) + }, + toggleMute () { + const store = this.$store + store.commit('setMuted', {user: this.user, muted: !this.user.muted}) } } } 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 }, |
