forked from AkkomaGang/akkoma-fe
Just save blocks/mutes instead of adding
This commit is contained in:
parent
1fd9a1c7c0
commit
8f608e060c
1 changed files with 6 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
|
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
|
||||||
import { compact, map, each, merge, find, union } from 'lodash'
|
import { compact, map, each, merge, find } from 'lodash'
|
||||||
import { set } from 'vue'
|
import { set } from 'vue'
|
||||||
import { registerPushNotifications, unregisterPushNotifications } from '../services/push/push.js'
|
import { registerPushNotifications, unregisterPushNotifications } from '../services/push/push.js'
|
||||||
import oauthApi from '../services/new_api/oauth'
|
import oauthApi from '../services/new_api/oauth'
|
||||||
|
@ -85,13 +85,11 @@ export const mutations = {
|
||||||
addNewUsers (state, users) {
|
addNewUsers (state, users) {
|
||||||
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
||||||
},
|
},
|
||||||
addBlocks (state, blockIds) {
|
saveBlocks (state, blockIds) {
|
||||||
const user = state.currentUser
|
state.currentUser.blockIds = blockIds
|
||||||
user.blockIds = union(user.blockIds, blockIds)
|
|
||||||
},
|
},
|
||||||
saveMutes (state, ids) {
|
saveMutes (state, muteIds) {
|
||||||
const user = state.currentUser
|
state.currentUser.muteIds = muteIds
|
||||||
user.muteIds = union(user.muteIds, ids)
|
|
||||||
},
|
},
|
||||||
setUserForStatus (state, status) {
|
setUserForStatus (state, status) {
|
||||||
status.user = state.usersObject[status.user.id]
|
status.user = state.usersObject[status.user.id]
|
||||||
|
@ -148,7 +146,7 @@ const users = {
|
||||||
fetchBlocks (store) {
|
fetchBlocks (store) {
|
||||||
return store.rootState.api.backendInteractor.fetchBlocks()
|
return store.rootState.api.backendInteractor.fetchBlocks()
|
||||||
.then((blocks) => {
|
.then((blocks) => {
|
||||||
store.commit('addBlocks', map(blocks, 'id'))
|
store.commit('saveBlocks', map(blocks, 'id'))
|
||||||
store.commit('addNewUsers', blocks)
|
store.commit('addNewUsers', blocks)
|
||||||
return blocks
|
return blocks
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue