|
|
@ -146,26 +146,19 @@ export const mutations = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
addNewUsers (state, users) {
|
|
|
|
addNewUsers (state, users) {
|
|
|
|
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
|
|
|
each(users, (user) => {
|
|
|
|
|
|
|
|
// console.log(user)
|
|
|
|
|
|
|
|
if (user.relationship) {
|
|
|
|
|
|
|
|
set(state.relationships, user.relationship.id, user.relationship)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mergeOrAdd(state.users, state.usersObject, user)
|
|
|
|
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
updateUserRelationship (state, relationships) {
|
|
|
|
updateUserRelationship (state, relationships) {
|
|
|
|
relationships.forEach((relationship) => {
|
|
|
|
relationships.forEach((relationship) => {
|
|
|
|
const user = state.usersObject[relationship.id]
|
|
|
|
set(state.relationships, relationship.id, relationship)
|
|
|
|
if (user) {
|
|
|
|
|
|
|
|
user.follows_you = relationship.followed_by
|
|
|
|
|
|
|
|
user.following = relationship.following
|
|
|
|
|
|
|
|
user.muted = relationship.muting
|
|
|
|
|
|
|
|
user.statusnet_blocking = relationship.blocking
|
|
|
|
|
|
|
|
user.subscribed = relationship.subscribing
|
|
|
|
|
|
|
|
user.showing_reblogs = relationship.showing_reblogs
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
updateBlocks (state, blockedUsers) {
|
|
|
|
|
|
|
|
// Reset statusnet_blocking of all fetched users
|
|
|
|
|
|
|
|
each(state.users, (user) => { user.statusnet_blocking = false })
|
|
|
|
|
|
|
|
each(blockedUsers, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
saveBlockIds (state, blockIds) {
|
|
|
|
saveBlockIds (state, blockIds) {
|
|
|
|
state.currentUser.blockIds = blockIds
|
|
|
|
state.currentUser.blockIds = blockIds
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -174,11 +167,6 @@ export const mutations = {
|
|
|
|
state.currentUser.blockIds.push(blockId)
|
|
|
|
state.currentUser.blockIds.push(blockId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
updateMutes (state, mutedUsers) {
|
|
|
|
|
|
|
|
// Reset muted of all fetched users
|
|
|
|
|
|
|
|
each(state.users, (user) => { user.muted = false })
|
|
|
|
|
|
|
|
each(mutedUsers, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
saveMuteIds (state, muteIds) {
|
|
|
|
saveMuteIds (state, muteIds) {
|
|
|
|
state.currentUser.muteIds = muteIds
|
|
|
|
state.currentUser.muteIds = muteIds
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -254,7 +242,8 @@ export const defaultState = {
|
|
|
|
users: [],
|
|
|
|
users: [],
|
|
|
|
usersObject: {},
|
|
|
|
usersObject: {},
|
|
|
|
signUpPending: false,
|
|
|
|
signUpPending: false,
|
|
|
|
signUpErrors: []
|
|
|
|
signUpErrors: [],
|
|
|
|
|
|
|
|
relationships: {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const users = {
|
|
|
|
const users = {
|
|
|
@ -279,7 +268,7 @@ const users = {
|
|
|
|
return store.rootState.api.backendInteractor.fetchBlocks()
|
|
|
|
return store.rootState.api.backendInteractor.fetchBlocks()
|
|
|
|
.then((blocks) => {
|
|
|
|
.then((blocks) => {
|
|
|
|
store.commit('saveBlockIds', map(blocks, 'id'))
|
|
|
|
store.commit('saveBlockIds', map(blocks, 'id'))
|
|
|
|
store.commit('updateBlocks', blocks)
|
|
|
|
store.commit('addNewUsers', blocks)
|
|
|
|
return blocks
|
|
|
|
return blocks
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -298,8 +287,8 @@ const users = {
|
|
|
|
fetchMutes (store) {
|
|
|
|
fetchMutes (store) {
|
|
|
|
return store.rootState.api.backendInteractor.fetchMutes()
|
|
|
|
return store.rootState.api.backendInteractor.fetchMutes()
|
|
|
|
.then((mutes) => {
|
|
|
|
.then((mutes) => {
|
|
|
|
store.commit('updateMutes', mutes)
|
|
|
|
|
|
|
|
store.commit('saveMuteIds', map(mutes, 'id'))
|
|
|
|
store.commit('saveMuteIds', map(mutes, 'id'))
|
|
|
|
|
|
|
|
store.commit('addNewUsers', mutes)
|
|
|
|
return mutes
|
|
|
|
return mutes
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -416,7 +405,7 @@ const users = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
addNewNotifications (store, { notifications }) {
|
|
|
|
addNewNotifications (store, { notifications }) {
|
|
|
|
const users = map(notifications, 'from_profile')
|
|
|
|
const users = map(notifications, 'from_profile')
|
|
|
|
const targetUsers = map(notifications, 'target')
|
|
|
|
const targetUsers = map(notifications, 'target').filter(_ => _)
|
|
|
|
const notificationIds = notifications.map(_ => _.id)
|
|
|
|
const notificationIds = notifications.map(_ => _.id)
|
|
|
|
store.commit('addNewUsers', users)
|
|
|
|
store.commit('addNewUsers', users)
|
|
|
|
store.commit('addNewUsers', targetUsers)
|
|
|
|
store.commit('addNewUsers', targetUsers)
|
|
|
|