From 731d622aa7cb6847a5821764317e25489bb37be8 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 6 Oct 2020 15:38:53 +0200 Subject: [PATCH] [Groups] Allow to promote/demote to moderator Signed-off-by: Thomas Citharel --- js/src/views/Group/GroupMembers.vue | 31 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/js/src/views/Group/GroupMembers.vue b/js/src/views/Group/GroupMembers.vue index f7c2e431a..4a7d886fd 100644 --- a/js/src/views/Group/GroupMembers.vue +++ b/js/src/views/Group/GroupMembers.vue @@ -142,19 +142,22 @@
{{ $t("Promote") }} {{ $t("Demote") }} {{ $t("Remove") }}
@@ -329,12 +332,24 @@ export default class GroupMembers extends Vue { }); } - promoteMember(memberId: string): Promise { - return this.updateMember(memberId, MemberRole.ADMINISTRATOR); + promoteMember(member: IMember): void { + if (!member.id) return; + if (member.role === MemberRole.MODERATOR) { + this.updateMember(member.id, MemberRole.ADMINISTRATOR); + } + if (member.role === MemberRole.MEMBER) { + this.updateMember(member.id, MemberRole.MODERATOR); + } } - demoteMember(memberId: string): Promise { - return this.updateMember(memberId, MemberRole.MEMBER); + demoteMember(member: IMember): void { + if (!member.id) return; + if (member.role === MemberRole.MODERATOR) { + this.updateMember(member.id, MemberRole.MEMBER); + } + if (member.role === MemberRole.ADMINISTRATOR) { + this.updateMember(member.id, MemberRole.MODERATOR); + } } async updateMember(memberId: string, role: MemberRole): Promise {