Refactor follower/friends out of statuses/timeline into user_profile where it
belongs. Changed display of profile to single panel with tabs.
This commit is contained in:
parent
eaf065c751
commit
8f255fbad4
6 changed files with 110 additions and 83 deletions
|
@ -14,7 +14,6 @@ const emptyTl = () => ({
|
|||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
viewing: 'statuses',
|
||||
userId: 0,
|
||||
flushMarker: 0
|
||||
})
|
||||
|
@ -399,16 +398,6 @@ export const mutations = {
|
|||
setNotificationsSilence (state, { value }) {
|
||||
state.notifications.desktopNotificationSilence = value
|
||||
},
|
||||
setProfileView (state, { v }) {
|
||||
// load followers / friends only when needed
|
||||
state.timelines['user'].viewing = v
|
||||
},
|
||||
addFriends (state, { friends }) {
|
||||
state.timelines['user'].friends = friends
|
||||
},
|
||||
addFollowers (state, { followers }) {
|
||||
state.timelines['user'].followers = followers
|
||||
},
|
||||
markNotificationsAsSeen (state) {
|
||||
each(state.notifications.data, (notification) => {
|
||||
notification.seen = true
|
||||
|
@ -437,12 +426,6 @@ const statuses = {
|
|||
setNotificationsSilence ({ rootState, commit }, { value }) {
|
||||
commit('setNotificationsSilence', { value })
|
||||
},
|
||||
addFriends ({ rootState, commit }, { friends }) {
|
||||
commit('addFriends', { friends })
|
||||
},
|
||||
addFollowers ({ rootState, commit }, { followers }) {
|
||||
commit('addFollowers', { followers })
|
||||
},
|
||||
deleteStatus ({ rootState, commit }, status) {
|
||||
commit('setDeleted', { status })
|
||||
apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
||||
|
|
|
@ -51,6 +51,15 @@ export const mutations = {
|
|||
endLogin (state) {
|
||||
state.loggingIn = false
|
||||
},
|
||||
// TODO Clean after ourselves?
|
||||
addFriends (state, { id, friends }) {
|
||||
const user = state.usersObject[id]
|
||||
user.friends = friends
|
||||
},
|
||||
addFollowers (state, { id, followers }) {
|
||||
const user = state.usersObject[id]
|
||||
user.followers = followers
|
||||
},
|
||||
addNewUsers (state, users) {
|
||||
each(users, (user) => mergeOrAdd(state.users, state.usersObject, user))
|
||||
},
|
||||
|
@ -92,6 +101,14 @@ const users = {
|
|||
store.rootState.api.backendInteractor.fetchUser({ id })
|
||||
.then((user) => store.commit('addNewUsers', [user]))
|
||||
},
|
||||
addFriends ({ rootState, commit }, { id }) {
|
||||
rootState.api.backendInteractor.fetchFriends({ id })
|
||||
.then((friends) => commit('addFriends', { id, friends }))
|
||||
},
|
||||
addFollowers ({ rootState, commit }, { id }) {
|
||||
rootState.api.backendInteractor.fetchFollowers({ id })
|
||||
.then((followers) => commit('addFollowers', { id, followers }))
|
||||
},
|
||||
registerPushNotifications (store) {
|
||||
const token = store.state.currentUser.credentials
|
||||
const vapidPublicKey = store.rootState.instance.vapidPublicKey
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue