Add mute/unmute featrue and mutes management tab

This commit is contained in:
taehoon 2019-02-24 03:02:04 -05:00
parent 66e60572bc
commit 3255950b0e
8 changed files with 94 additions and 31 deletions

View file

@ -12,7 +12,7 @@ const MuteCard = {
return this.$store.getters.findUser(this.userId)
},
muted () {
return this.user.muted
return this.user.mastodonMuted
}
},
components: {

View file

@ -121,21 +121,19 @@ export default {
})
},
blockUser () {
const store = this.$store
store.state.api.backendInteractor.blockUser(this.user.id)
.then((blockedUser) => {
store.commit('addNewUsers', [blockedUser])
store.commit('removeStatus', { timeline: 'friends', userId: this.user.id })
store.commit('removeStatus', { timeline: 'public', userId: this.user.id })
store.commit('removeStatus', { timeline: 'publicAndExternal', userId: this.user.id })
})
this.$store.dispatch('blockUser', this.user.id)
},
unblockUser () {
const store = this.$store
store.state.api.backendInteractor.unblockUser(this.user.id)
.then((unblockedUser) => store.commit('addNewUsers', [unblockedUser]))
this.$store.dispatch('unblockUser', this.user.id)
},
muteUser () { // Mastodon Mute
this.$store.dispatch('muteUser', this.user.id)
},
unmuteUser () { // Mastodon Unmute
this.$store.dispatch('unmuteUser', this.user.id)
},
toggleMute () {
// TODO: Pleroma mute/unmute, Need to migrate to the Mastodon API
const store = this.$store
store.commit('setMuted', {user: this.user, muted: !this.user.muted})
store.state.api.backendInteractor.setUserMute(this.user)

View file

@ -74,12 +74,12 @@
</div>
<div class='mute' v-if='isOtherUser && loggedIn'>
<span v-if='user.muted'>
<button @click="toggleMute" class="pressed">
<button @click="unmuteUser" class="pressed">
{{ $t('user_card.muted') }}
</button>
</span>
<span v-if='!user.muted'>
<button @click="toggleMute">
<button @click="muteUser">
{{ $t('user_card.mute') }}
</button>
</span>

View file

@ -192,6 +192,12 @@
<template slot="empty">{{$t('settings.no_blocks')}}</template>
</block-list>
</div>
<div :label="$t('settings.mutes_tab')">
<mute-list :refresh="true">
<template slot="empty">{{$t('settings.no_mutes')}}</template>
</mute-list>
</div>
</tab-switcher>
</div>
</div>