Skip to content

Commit

Permalink
feat(role-settings): remove double beacon value and add auto change f…
Browse files Browse the repository at this point in the history
…or both when its modified
  • Loading branch information
marc.sirisak committed Jul 2, 2024
1 parent a3649d9 commit 0c4971b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {
// deep copy "events" object, Object.assign itself won't deep copy
plContent["events"] = Object.assign({}, plContent["events"] || {});
plContent["events"][powerLevelKey.slice(eventsLevelPrefix.length)] = value;

// :TCHAP: roles-power-setting-titles also modify the stable value since we removed it from the list
if (powerLevelKey.slice(eventsLevelPrefix.length) === M_BEACON_INFO.name) {
plContent["events"][M_BEACON_INFO.altName] = value;
}
// end :TCHAP:
} else {
const keyPath = powerLevelKey.split(".");
let parentObj: IContent = {};
Expand Down Expand Up @@ -443,7 +449,8 @@ export default class RolesRoomSettingsTab extends React.Component<IProps> {
// :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
// Its in double because of our custom roomaccess control in which we add default value to allow share location
// cf https://github.com/tchapgouv/synapse-room-access-rules/pull/3
delete eventsLevels[M_BEACON_INFO.altName];
}
// end :TCHAP:
Expand Down

0 comments on commit 0c4971b

Please sign in to comment.