Skip to content

Commit

Permalink
feat(role-settings): remove conditional titles for role power level s…
Browse files Browse the repository at this point in the history
…ettings
  • Loading branch information
marc.sirisak committed Jul 2, 2024
1 parent 827f3fd commit a3649d9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import React from "react";
import { EventType, RoomMember, RoomState, RoomStateEvent, Room, IContent } from "matrix-js-sdk/src/matrix";
import { EventType, RoomMember, RoomState, RoomStateEvent, Room, IContent, M_BEACON_INFO } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { throttle, get } from "lodash";
import { KnownMembership, RoomPowerLevelsEventContent } from "matrix-js-sdk/src/types";
Expand Down Expand Up @@ -279,17 +279,27 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {
// TODO: Enable support for m.widget event type (https://github.com/vector-im/element-web/issues/13111)
"im.vector.modular.widgets": isSpaceRoom ? null : _td("room_settings|permissions|m.widget"),
[VoiceBroadcastInfoEventType]: _td("room_settings|permissions|io.element.voice_broadcast_info"),

// :TCHAP: roles-power-setting-titles
[M_BEACON_INFO.name]: _td("room_settings|permissions|beacon_info"),
// end :TCHAP:
};

if (SettingsStore.getValue("feature_pinning")) {
plEventsToLabels[EventType.RoomPinnedEvents] = _td("room_settings|permissions|m.room.pinned_events");
}
// :TCHAP: roles-power-setting-titles
// if (SettingsStore.getValue("feature_pinning")) {
// plEventsToLabels[EventType.RoomPinnedEvents] = _td("room_settings|permissions|m.room.pinned_events");
// }
// // MSC3401: Native Group VoIP signaling
// if (SettingsStore.getValue("feature_group_calls")) {
// plEventsToLabels[ElementCall.CALL_EVENT_TYPE.name] = _td("room_settings|permissions|m.call");
// plEventsToLabels[ElementCall.MEMBER_EVENT_TYPE.name] = _td("room_settings|permissions|m.call.member");
// }
plEventsToLabels[EventType.RoomPinnedEvents] = _td("room_settings|permissions|m.room.pinned_events");
// MSC3401: Native Group VoIP signaling
if (SettingsStore.getValue("feature_group_calls")) {
plEventsToLabels[ElementCall.CALL_EVENT_TYPE.name] = _td("room_settings|permissions|m.call");
plEventsToLabels[ElementCall.MEMBER_EVENT_TYPE.name] = _td("room_settings|permissions|m.call.member");
}
plEventsToLabels[ElementCall.CALL_EVENT_TYPE.name] = _td("room_settings|permissions|m.call");
plEventsToLabels[ElementCall.MEMBER_EVENT_TYPE.name] = _td("room_settings|permissions|m.call.member");

// end :TCHAP:
const powerLevelDescriptors: Record<string, IPowerLevelDescriptor> = {
"users_default": {
desc: _t("room_settings|permissions|users_default"),
Expand Down Expand Up @@ -430,14 +440,22 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {
delete eventsLevels[EventType.RoomEncryption];
}

// :TCHAP: roles-power-setting-titles
if (eventsLevels?.hasOwnProperty(M_BEACON_INFO.altName)) {
// We already have the info on M_BEACON_INFO.name,
// don't know why its in double, it is not present in element
delete eventsLevels[M_BEACON_INFO.altName];
}
// end :TCHAP:

const eventPowerSelectors = Object.keys(eventsLevels)
.map((eventType, i) => {
if (isSpaceRoom && plEventsToShow[eventType]?.hideForSpace) {
return null;
} else if (!isSpaceRoom && plEventsToShow[eventType]?.hideForRoom) {
return null;
}

const translationKeyForEvent = plEventsToLabels[eventType];
let label: string;
if (translationKeyForEvent) {
Expand Down
4 changes: 4 additions & 0 deletions modules/tchap-translations/tchap_translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -757,5 +757,9 @@
"lasuite_numerique": {
"en": "La suite numérique",
"fr": "La suite numérique"
},
"room_settings|permissions|beacon_info": {
"en": "Share your position data",
"fr": "Partager les informations de position"
}
}
6 changes: 6 additions & 0 deletions patches/subtree-modifications.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,11 @@
"files": [
"src/components/views/dialogs/InviteDialog.tsx"
]
},
"roles-power-settings-rename-titles": {
"issue": "https://github.com/tchapgouv/tchap-web-v4/issues/1017",
"files": [
"src/components/views/settings/tabs/room/RolesRoomSettingsTab.tsx"
]
}
}

0 comments on commit a3649d9

Please sign in to comment.