diff options
author | Nikola <nikola.gladovic@nextcloud.com> | 2022-02-21 15:57:15 +0300 |
---|---|---|
committer | Nikola <nikola.gladovic@nextcloud.com> | 2022-02-21 15:57:15 +0300 |
commit | bcadee7e9006cba95d99e8f1be805c0418aa7091 (patch) | |
tree | 3487f11aad81ac7d76a63e2e28fa8f9c0df2b37f | |
parent | a9b9ea4c460733140ae57c5c4547f508d7c5d85a (diff) |
6697: updated sort participants according to permissions
Signed-off-by: Nikola <nikola.gladovic@nextcloud.com>
-rw-r--r-- | src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue b/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue index b7bfe422a..0c8b0c981 100644 --- a/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue +++ b/src/components/RightSidebar/Participants/CurrentParticipants/CurrentParticipants.vue @@ -21,8 +21,8 @@ <template> <div> - <ParticipantsList v-if="participantsList.length" - :items="participantsList" + <ParticipantsList v-if="participants.length" + :items="participants" :loading="!participantsInitialised" /> <Hint v-else :hint="t('spreed', 'No search results')" /> </div> @@ -58,18 +58,21 @@ export default { default: true, }, }, - + data() { + return { + isCurrentuserBeAdmin: false, + } + }, computed: { token() { return this.$store.getters.getToken() }, - /** * Gets the participants array. * * @return {Array} */ - participantsList() { + participants() { let participants = this.$store.getters.participantsList(this.token) if (this.searchText !== '') { @@ -81,6 +84,13 @@ export default { }) } + const currentParticipant = participants.find(x => x.actorId === this.$store.getters.getUserId()) + if (currentParticipant) { + const moderatorTypes = [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR] + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + this.isCurrentuserBeAdmin = moderatorTypes.indexOf(currentParticipant.participantType) !== -1 + } + return participants.slice().sort(this.sortParticipants) }, }, @@ -203,14 +213,15 @@ export default { return moderator1 ? -1 : 1 } - if (p1inCall) { - return participant1.attendeePermissions < participant2.attendeePermissions ? 1 : -1 - } + if (this.isCurrentuserBeAdmin) { + if (p1inCall) { + return participant1.attendeePermissions < participant2.attendeePermissions ? 1 : -1 + } - if (p1inCall && participant1.attendeePermissions === participant2.attendeePermissions) { - return participant1.inCall < participant2.inCall ? 1 : -1 + if (p1inCall && participant1.attendeePermissions === participant2.attendeePermissions) { + return participant1.inCall < participant2.inCall ? 1 : -1 + } } - const participant1Away = this.isNotAvailable(participant1) const participant2Away = this.isNotAvailable(participant2) if (participant1Away !== participant2Away) { |