Add follower and following views
This commit is contained in:
parent
dbad99cb4f
commit
ccfc2e57d0
12 changed files with 229 additions and 28 deletions
|
@ -19,7 +19,10 @@ export const defaultState = {
|
|||
newStatusCount: 0,
|
||||
maxId: 0,
|
||||
minVisibleId: 0,
|
||||
loading: false
|
||||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
viewing: 'statuses'
|
||||
},
|
||||
public: {
|
||||
statuses: [],
|
||||
|
@ -30,7 +33,10 @@ export const defaultState = {
|
|||
newStatusCount: 0,
|
||||
maxId: 0,
|
||||
minVisibleId: 0,
|
||||
loading: false
|
||||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
viewing: 'statuses'
|
||||
},
|
||||
user: {
|
||||
statuses: [],
|
||||
|
@ -41,7 +47,10 @@ export const defaultState = {
|
|||
newStatusCount: 0,
|
||||
maxId: 0,
|
||||
minVisibleId: 0,
|
||||
loading: false
|
||||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
viewing: 'statuses'
|
||||
},
|
||||
publicAndExternal: {
|
||||
statuses: [],
|
||||
|
@ -52,7 +61,10 @@ export const defaultState = {
|
|||
newStatusCount: 0,
|
||||
maxId: 0,
|
||||
minVisibleId: 0,
|
||||
loading: false
|
||||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
viewing: 'statuses'
|
||||
},
|
||||
friends: {
|
||||
statuses: [],
|
||||
|
@ -63,7 +75,10 @@ export const defaultState = {
|
|||
newStatusCount: 0,
|
||||
maxId: 0,
|
||||
minVisibleId: 0,
|
||||
loading: false
|
||||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
viewing: 'statuses'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,7 +331,10 @@ export const mutations = {
|
|||
newStatusCount: 0,
|
||||
maxId: 0,
|
||||
minVisibleId: 0,
|
||||
loading: false
|
||||
loading: false,
|
||||
followers: [],
|
||||
friends: [],
|
||||
viewing: 'statuses'
|
||||
}
|
||||
|
||||
state.timelines[timeline] = emptyTimeline
|
||||
|
@ -343,6 +361,16 @@ export const mutations = {
|
|||
setError (state, { value }) {
|
||||
state.error = 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, notifications) {
|
||||
each(notifications, (notification) => {
|
||||
notification.seen = true
|
||||
|
@ -359,6 +387,12 @@ const statuses = {
|
|||
setError ({ rootState, commit }, { value }) {
|
||||
commit('setError', { 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 })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue