forked from AkkomaGang/akkoma-fe
Merge branch 'fix/remove-posts-immediately-by-blocking-someone' into 'develop'
#330 Remove posts immediately by blocking someone See merge request pleroma/pleroma-fe!589
This commit is contained in:
commit
e3b3ef156b
2 changed files with 23 additions and 4 deletions
|
@ -93,22 +93,30 @@ 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
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
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.commit('removeStatus', { timeline: 'friends', userId: this.user.id })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
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.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 })
|
||||||
|
})
|
||||||
},
|
},
|
||||||
unblockUser () {
|
unblockUser () {
|
||||||
const store = this.$store
|
const store = this.$store
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { remove, slice, each, find, maxBy, minBy, merge, last, isArray } from 'lodash'
|
import { remove, slice, each, find, maxBy, minBy, merge, first, last, isArray } from 'lodash'
|
||||||
import apiService from '../services/api/api.service.js'
|
import apiService from '../services/api/api.service.js'
|
||||||
// import parse from '../services/status_parser/status_parser.js'
|
// import parse from '../services/status_parser/status_parser.js'
|
||||||
|
|
||||||
|
@ -312,9 +312,20 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeStatus = (state, { timeline, userId }) => {
|
||||||
|
const timelineObject = state.timelines[timeline]
|
||||||
|
if (userId) {
|
||||||
|
remove(timelineObject.statuses, { user: { id: userId } })
|
||||||
|
remove(timelineObject.visibleStatuses, { user: { id: userId } })
|
||||||
|
timelineObject.minVisibleId = timelineObject.visibleStatuses.length > 0 ? last(timelineObject.visibleStatuses).id : 0
|
||||||
|
timelineObject.maxId = timelineObject.statuses.length > 0 ? first(timelineObject.statuses).id : 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
addNewStatuses,
|
addNewStatuses,
|
||||||
addNewNotifications,
|
addNewNotifications,
|
||||||
|
removeStatus,
|
||||||
showNewStatuses (state, { timeline }) {
|
showNewStatuses (state, { timeline }) {
|
||||||
const oldTimeline = (state.timelines[timeline])
|
const oldTimeline = (state.timelines[timeline])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue