Add group view to timeline.
This commit is contained in:
parent
d4de464ab5
commit
7a3e608455
3 changed files with 34 additions and 0 deletions
|
@ -25,6 +25,9 @@ const Timeline = {
|
|||
friends () {
|
||||
return this.timeline.friends
|
||||
},
|
||||
members () {
|
||||
return this.timeline.members
|
||||
},
|
||||
viewing () {
|
||||
return this.timeline.viewing
|
||||
},
|
||||
|
@ -58,6 +61,9 @@ const Timeline = {
|
|||
this.fetchFriends()
|
||||
this.fetchFollowers()
|
||||
}
|
||||
if (this.timelineName === 'group') {
|
||||
this.fetchGroup()
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
window.removeEventListener('scroll', this.scrollLoad)
|
||||
|
@ -91,6 +97,13 @@ const Timeline = {
|
|||
this.$store.state.api.backendInteractor.fetchFriends({ id })
|
||||
.then((friends) => this.$store.dispatch('addFriends', { friends }))
|
||||
},
|
||||
fetchGroup () {
|
||||
const ident = this.groupName
|
||||
this.$store.dispatch('fetchGroup', { 'groupName': ident })
|
||||
this.$store.dispatch('fetchIsMember', { 'groupName': ident, 'id': this.$store.state.users.currentUser.id })
|
||||
this.$store.state.api.backendInteractor.fetchMembers({ 'groupName': ident })
|
||||
.then((members) => this.$store.dispatch('addMembers', { members }))
|
||||
},
|
||||
scrollLoad (e) {
|
||||
let height = Math.max(document.body.offsetHeight, document.body.scrollHeight)
|
||||
if (this.timeline.loading === false &&
|
||||
|
|
|
@ -48,6 +48,18 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="timeline panel panel-default" v-else-if="viewing == 'members'">
|
||||
<div class="panel-heading timeline-heading base01-background base04">
|
||||
<div class="title">
|
||||
{{$t('group_card.members')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body base02-background">
|
||||
<div class="timeline">
|
||||
<user-card v-for="member in members" :user="member" :showFollows="false"></user-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script src="./timeline.js"></script>
|
||||
|
||||
|
|
|
@ -412,12 +412,18 @@ export const mutations = {
|
|||
// load followers / friends only when needed
|
||||
state.timelines['user'].viewing = v
|
||||
},
|
||||
setGroupView (state, { v }) {
|
||||
state.timelines['group'].viewing = v
|
||||
},
|
||||
addFriends (state, { friends }) {
|
||||
state.timelines['user'].friends = friends
|
||||
},
|
||||
addFollowers (state, { followers }) {
|
||||
state.timelines['user'].followers = followers
|
||||
},
|
||||
addMembers (state, { members }) {
|
||||
state.timelines['group'].members = members
|
||||
},
|
||||
markNotificationsAsSeen (state, notifications) {
|
||||
each(notifications, (notification) => {
|
||||
notification.seen = true
|
||||
|
@ -440,6 +446,9 @@ const statuses = {
|
|||
addFollowers ({ rootState, commit }, { followers }) {
|
||||
commit('addFollowers', { followers })
|
||||
},
|
||||
addMembers ({ rootState, commit }, { members }) {
|
||||
commit('addMembers', { members })
|
||||
},
|
||||
deleteStatus ({ rootState, commit }, status) {
|
||||
commit('setDeleted', { status })
|
||||
apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials })
|
||||
|
|
Loading…
Add table
Reference in a new issue