Remove posts immediately by blocking

This commit is contained in:
jasper 2019-02-15 07:52:34 -08:00
parent 10990e1715
commit 6c8ccf2733

View file

@ -93,27 +93,55 @@ export default {
}, },
methods: { methods: {
followUser () { followUser () {
const store = this.$store
this.followRequestInProgress = true this.followRequestInProgress = true
requestFollow(this.user, this.$store).then(({sent}) => { requestFollow(this.user, store).then(({sent}) => {
this.followRequestInProgress = false this.followRequestInProgress = false
this.followRequestSent = sent this.followRequestSent = sent
store.dispatch('stopFetching', 'friends')
store.commit('clearTimeline', { timeline: 'friends' })
store.dispatch('startFetching', { timeline: 'friends' })
}) })
}, },
unfollowUser () { unfollowUser () {
const store = this.$store
this.followRequestInProgress = true this.followRequestInProgress = true
requestUnfollow(this.user, this.$store).then(() => { requestUnfollow(this.user, store).then(() => {
this.followRequestInProgress = false this.followRequestInProgress = false
store.dispatch('stopFetching', 'friends')
store.commit('clearTimeline', { timeline: 'friends' })
store.dispatch('startFetching', { timeline: 'friends' })
}) })
}, },
blockUser () { blockUser () {
const store = this.$store const store = this.$store
store.state.api.backendInteractor.blockUser(this.user.id) store.state.api.backendInteractor.blockUser(this.user.id)
.then((blockedUser) => store.commit('addNewUsers', [blockedUser])) .then((blockedUser) => {
store.commit('addNewUsers', [blockedUser])
store.dispatch('stopFetching', 'friends')
store.commit('clearTimeline', { timeline: 'friends' })
store.dispatch('startFetching', { timeline: 'friends' })
store.commit('clearTimeline', { timeline: 'public' })
store.commit('clearTimeline', { timeline: 'publicAndExternal' })
})
}, },
unblockUser () { unblockUser () {
const store = this.$store const store = this.$store
store.state.api.backendInteractor.unblockUser(this.user.id) store.state.api.backendInteractor.unblockUser(this.user.id)
.then((unblockedUser) => store.commit('addNewUsers', [unblockedUser])) .then((unblockedUser) => {
store.commit('addNewUsers', [unblockedUser])
store.dispatch('stopFetching', 'friends')
store.commit('clearTimeline', { timeline: 'friends' })
store.dispatch('startFetching', { timeline: 'friends' })
store.commit('clearTimeline', { timeline: 'public' })
store.commit('clearTimeline', { timeline: 'publicAndExternal' })
})
}, },
toggleMute () { toggleMute () {
const store = this.$store const store = this.$store