modtools: Remove duplicate roles in dropdown

This commit is contained in:
JC Brand 2020-02-21 13:06:15 +01:00
parent 3c9ec96350
commit cd442f27c4

View File

@ -258,10 +258,10 @@ converse.plugins.add('converse-muc-views', {
toHTML () {
const allowed_commands = this.chatroomview.getAllowedCommands();
const allowed_affiliations = allowed_commands.map(c => COMMAND_TO_AFFILIATION[c]).filter(c => c);
const allowed_roles = allowed_commands
const allowed_roles = [...new Set(allowed_commands
.filter((value, i, list) => list.indexOf(value) == i)
.map(c => COMMAND_TO_ROLE[c])
.filter(c => c);
.filter(c => c))];
allowed_affiliations.sort();
allowed_roles.sort();