Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

improve privileged section users in room settings #1902

Merged
merged 3 commits into from
May 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 51 additions & 20 deletions src/components/views/rooms/RoomSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,26 +695,57 @@ module.exports = React.createClass({
relatedGroupsEvent={this.props.room.currentState.getStateEvents('m.room.related_groups', '')}
/>;

let userLevelsSection;
let privilegedUsersSection = <div>{ _t('No users have specific privileges in this room') }.</div>; // default
let mutedUsersSection;
if (Object.keys(userLevels).length) {
userLevelsSection =
<div>
<h3>{ _t('Privileged Users') }</h3>
<ul className="mx_RoomSettings_userLevels">
{ Object.keys(userLevels).map(function(user, i) {
return (
<li className="mx_RoomSettings_userLevel" key={user}>
{ _t("%(user)s is a %(userRole)s", {
user: user,
userRole: <PowerSelector value={userLevels[user]} disabled={true} />,
}) }
</li>
);
const privilegedUsers = [];
const mutedUsers = [];

Object.keys(userLevels).forEach(function(user) {
if (userLevels[user] > defaultUserLevel) { // privileged
privilegedUsers.push(<li className="mx_RoomSettings_userLevel" key={user}>
{ _t("%(user)s is a %(userRole)s", {
user: user,
userRole: <PowerSelector value={userLevels[user]} disabled={true} />,
}) }
</ul>
</div>;
} else {
userLevelsSection = <div>{ _t('No users have specific privileges in this room') }.</div>;
</li>);
} else if (userLevels[user] < defaultUserLevel) { // muted
mutedUsers.push(<li className="mx_RoomSettings_userLevel" key={user}>
{ _t("%(user)s is a %(userRole)s", {
user: user,
userRole: <PowerSelector value={userLevels[user]} disabled={true} />,
}) }
</li>);
}
});

// comparator for sorting PL users lexicographically on PL descending, MXID ascending. (case-insensitive)
const comparator = (a, b) => {
const plDiff = userLevels[b.key] - userLevels[a.key];
return plDiff !== 0 ? plDiff : a.key.toLocaleLowerCase().localeCompare(b.key.toLocaleLowerCase());
};

privilegedUsers.sort(comparator);
mutedUsers.sort(comparator);

if (privilegedUsers.length) {
privilegedUsersSection =
<div>
<h3>{ _t('Privileged Users') }</h3>
<ul className="mx_RoomSettings_userLevels">
{ privilegedUsers }
</ul>
</div>;
}
if (mutedUsers.length) {
mutedUsersSection =
<div>
<h3>{ _t('Muted Users') }</h3>
<ul className="mx_RoomSettings_userLevels">
{ mutedUsers }
</ul>
</div>;
}
}

const banned = this.props.room.getMembersWithMembership("ban");
Expand Down Expand Up @@ -979,8 +1010,8 @@ module.exports = React.createClass({
{ unfederatableSection }
</div>

{ userLevelsSection }

{ privilegedUsersSection }
{ mutedUsersSection }
{ bannedUsersSection }

<h3>{ _t('Advanced') }</h3>
Expand Down
7 changes: 0 additions & 7 deletions src/i18n/strings/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,6 @@
"You should not yet trust it to secure data": "Все още не трябва да се доверявате на това, че ще защити Вашите данни",
"Invalid file%(extra)s": "Невалиден файл%(extra)s",
"Error decrypting image": "Грешка при разшифроване на снимка",
"This image cannot be displayed.": "Тази снимка не може да бъде показана.",
"Image '%(Body)s' cannot be displayed.": "Снимката '%(Body)s' не може да бъде показана.",
"Error decrypting video": "Грешка при разшифроване на видео",
"%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s промени аватара на %(roomName)s",
"%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s премахна аватара на стаята.",
Expand Down Expand Up @@ -713,9 +711,7 @@
"Ignore request": "Игнорирай поканата",
"Loading device info...": "Зареждане на информация за устройството...",
"Encryption key request": "Заявка за ключ за шифроване",
"Otherwise, <a>click here</a> to send a bug report.": "В противен случай, <a>натиснете тук</a>, за да изпратите съобщение за грешка.",
"Unable to restore session": "Неуспешно възстановяване на сесията",
"Continue anyway": "Продължи въпреки това",
"Invalid Email Address": "Невалиден имейл адрес",
"This doesn't appear to be a valid email address": "Това не изглежда да е валиден имейл адрес",
"Please check your email and click on the link it contains. Once this is done, click continue.": "Моля, проверете своя имейл адрес и натиснете връзката, която той съдържа. След като направите това, натиснете продължи.",
Expand Down Expand Up @@ -962,7 +958,6 @@
"Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Сигурни ли сте, че искате да премахнете (изтриете) това събитие? Забележете, че ако изтриете събитие за промяна на името на стая или тема, това може да обърне промяната.",
"To verify that this device can be trusted, please contact its owner using some other means (e.g. in person or a phone call) and ask them whether the key they see in their User Settings for this device matches the key below:": "За да потвърдите, че на това устройство може да се вярва, моля свържете се със собственика му по друг начин (напр. на живо или чрез телефонен разговор) и го попитайте дали ключът, който той вижда в неговите настройки на потребителя за това устройство, съвпада с ключа по-долу:",
"If it matches, press the verify button below. If it doesn't, then someone else is intercepting this device and you probably want to press the blacklist button instead.": "Ако съвпада, моля натиснете бутона за потвърждение по-долу. Ако не, то тогава някой друг имитира това устройство и вероятно искате вместо това да натиснете бутона за черен списък.",
"We encountered an error trying to restore your previous session. If you continue, you will need to log in again, and encrypted chat history will be unreadable.": "Засякохме грешка при опита за възстановяване на предишната Ви сесия. Ако продължите, ще трябва да влезете в профила си отново. Шифрованата история на чата няма да бъде четима.",
"If you have previously used a more recent version of Riot, your session may be incompatible with this version. Close this window and return to the more recent version.": "Ако преди сте използвали по-нова версия на Riot, Вашата сесия може да не бъде съвместима с текущата версия. Затворете този прозорец и се върнете в по-новата версия.",
"This will be your account name on the <span></span> homeserver, or you can pick a <a>different server</a>.": "Това ще бъде името на профила Ви на <span></span> Home сървъра, или можете да изберете <a>друг сървър</a>.",
"We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.": "Препоръчваме Ви да минете през процеса за потвърждение за всяко устройство, за да потвърдите, че принадлежат на легитимен собственик. Ако предпочитате, можете да изпратите съобщение без потвърждение.",
Expand Down Expand Up @@ -996,7 +991,6 @@
"Join this community": "Присъединете се в тази общност",
"Leave this community": "Напуснете тази общност",
"Stickerpack": "Пакет със стикери",
"Sticker Messages": "Съобщения със стикери",
"You don't currently have any stickerpacks enabled": "В момента нямате включени пакети със стикери",
"Add a stickerpack": "Добави пакет със стикери",
"Hide Stickers": "Скрий стикери",
Expand Down Expand Up @@ -1108,7 +1102,6 @@
"Notify me for anything else": "Извести ме за всичко останало",
"When I'm invited to a room": "Когато ме поканят в стая",
"Keywords": "Ключови думи",
"<a>Click here</a> to create a GitHub issue.": "<a>Натиснете тук</a>, за да създадете GitHub issue.",
"Can't update user notification settings": "Неуспешно обновяване на потребителски настройки за известяване",
"Notify for all other messages/rooms": "Извести ме за всички други съобщения/стаи",
"Unable to look up room ID from server": "Стая с такъв идентификатор не е намерена на сървъра",
Expand Down
6 changes: 0 additions & 6 deletions src/i18n/strings/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,6 @@
"Download %(text)s": "Baixa %(text)s",
"Invalid file%(extra)s": "Fitxer invàlid%(extra)s",
"Error decrypting image": "S'ha produït un error en desencriptar la imatge",
"Image '%(Body)s' cannot be displayed.": "La imatge '%(Body)s' no es pot mostrar.",
"This image cannot be displayed.": "Aquesta imatge no es pot mostrar.",
"Error decrypting video": "S'ha produït un error en desencriptar el vídeo",
"%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s ha canviat el seu avatar per a la sala %(roomName)s",
"%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s ha eliminat l'avatar de la sala.",
Expand Down Expand Up @@ -694,9 +692,7 @@
"Ignore request": "Ignora la sol·licitud",
"Loading device info...": "S'està carregant la informació del dispositiu...",
"Encryption key request": "Sol·licitud de claus",
"Otherwise, <a>click here</a> to send a bug report.": "D'una altra manera, <a>click here</a> per a enviar un informe d'error.",
"Unable to restore session": "No s'ha pogut restaurar la sessió",
"Continue anyway": "Continua de totes maneres",
"Invalid Email Address": "El correu electrònic no és vàlid",
"This doesn't appear to be a valid email address": "Aquest no sembla ser un correu electrònic vàlid",
"Verification Pending": "Verificació pendent",
Expand All @@ -714,7 +710,6 @@
"This will be your account name on the <span></span> homeserver, or you can pick a <a>different server</a>.": "Aquest serà el nom del seu compte al <span></span> servidor amfitrió, o bé trieu-ne un altre <a>different server</a>.",
"If you already have a Matrix account you can <a>log in</a> instead.": "Si ja teniu un compte a Matrix, podeu <a>log in</a>.",
"Block users on other matrix homeservers from joining this room": "Impedeix als usuaris d'altres servidors de Matrix d'entrar a aquesta sala",
"We encountered an error trying to restore your previous session. If you continue, you will need to log in again, and encrypted chat history will be unreadable.": "Hem trobat un error en intentar restaurar la vostra sessió anterior. Si continueu, haureu d'iniciar la sessió de nou i l'historial de xat encriptat serà il·legible.",
"If you have previously used a more recent version of Riot, your session may be incompatible with this version. Close this window and return to the more recent version.": "Si anteriorment heu utilitzat un versió de Riot més recent, la vostra sessió podría ser incompatible amb aquesta versió. Tanqueu aquesta finestra i torneu a la versió més recent.",
"You are currently blacklisting unverified devices; to send messages to these devices you must verify them.": "Actualment teniu a la llista negre els dispositius no verificats; per enviar missatges a aquests dispositius, els heu de verificar abans.",
"We recommend you go through the verification process for each device to confirm they belong to their legitimate owner, but you can resend the message without verifying if you prefer.": "Recomanem que dugueu a terme el procès de verificació per a cada dispositiu per tal de confirmar que són del legítim propietari, però podeu enviar el missatge sense verificar-ho si ho preferiu.",
Expand Down Expand Up @@ -986,7 +981,6 @@
"Notify me for anything else": "Notifica'm per a qualsevol altra cosa",
"View Source": "Mostra el codi",
"Keywords": "Paraules clau",
"<a>Click here</a> to create a GitHub issue.": "<a>Clica aquí</a> per crear una issue a GitHub.",
"Can't update user notification settings": "No es poden actualitzar els paràmetres de les notificacions de l'usuari",
"Notify for all other messages/rooms": "Notifica per a tots els altres missatges o sales",
"Unable to look up room ID from server": "No s'ha pogut cercar l'ID de la sala en el servidor",
Expand Down
5 changes: 0 additions & 5 deletions src/i18n/strings/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@
"olm version:": "verze olm:",
"Once encryption is enabled for a room it cannot be turned off again (for now)": "Jakmile je jednou šifrování v místnosti zapnuto, nelze už vypnout (prozatím)",
"Only people who have been invited": "Pouze lidé, kteří byli pozváni",
"Otherwise, <a>click here</a> to send a bug report.": "V opačném případě <a>klikněte zde</a> a pošlete hlášení o chybě.",
"Password": "Heslo",
"Password:": "Heslo:",
"Passwords can't be empty": "Hesla nemohou být prázdná",
Expand Down Expand Up @@ -494,8 +493,6 @@
"You need to be able to invite users to do that.": "Pro tuto akci musíte mít právo zvát uživatele.",
"Delete Widget": "Smazat widget",
"Error decrypting image": "Chyba při dešifrování obrázku",
"Image '%(Body)s' cannot be displayed.": "Obrázek '%(Body)s' nemůže být zobrazen.",
"This image cannot be displayed.": "Tento obrázek nelze zobrazit.",
"Error decrypting video": "Chyba při dešifrování videa",
"%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s odstranil/a avatar místnosti.",
"%(senderDisplayName)s changed the room avatar to <img/>": "%(senderDisplayName)s změnil/a avatar místnosti na <img/>",
Expand Down Expand Up @@ -808,9 +805,7 @@
"Ignore request": "Ignorovat žádost",
"Encryption key request": "Žádost o šifrovací klíč",
"Unable to restore session": "Nelze obnovit relaci",
"We encountered an error trying to restore your previous session. If you continue, you will need to log in again, and encrypted chat history will be unreadable.": "Při pokusu o obnovení vaší předcházející relace se vyskytla chyba. Pokud budete pokračovat musíte se znovu přihlásit a historie šifrovaného rozhovoru nebude již dostupná.",
"If you have previously used a more recent version of Riot, your session may be incompatible with this version. Close this window and return to the more recent version.": "Pokud jste se v minulosti již přihlásili s novější verzi programu Riot, vaše relace nemusí být kompatibilní s touto verzí. Zavřete prosím toto okno a přihlaste se znovu pomocí nové verze.",
"Continue anyway": "Přesto pokračovat",
"Please check your email and click on the link it contains. Once this is done, click continue.": "Prosím, zkontrolujte si email a klikněte na odkaz ve zprávě, kterou jsme vám zaslali. V případě, že jste tak již učinili, klikněte na tlačítko Pokračovat.",
"This will allow you to reset your password and receive notifications.": "Toto vám umožní obnovit si heslo a přijímat oznámení emailem.",
"Skip": "Přeskočit",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/strings/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@
"There are advanced notifications which are not shown here": "Der er avancerede meddelelser, som ikke vises her",
"%(count)s Members|other": "%(count)s medlemmer",
"Logs sent": "Logfiler sendt",
"<a>Click here</a> to create a GitHub issue.": "<a>Klik her</a> for at oprette et GitHub-issue.",
"Reply": "Besvar",
"All messages (noisy)": "Alle meddelelser (højlydt)",
"GitHub issue link:": "Link til GitHub issue:",
Expand Down
Loading