update UrlPreview settings to be more privacy-aware in e2ee rooms
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
df58715a17
commit
891070d001
2 changed files with 68 additions and 30 deletions
|
@ -618,10 +618,26 @@ module.exports = React.createClass({
|
|||
}
|
||||
},
|
||||
|
||||
_updatePreviewUrlVisibility: function(room) {
|
||||
this.setState({
|
||||
showUrlPreview: SettingsStore.getValue("urlPreviewsEnabled", room.roomId),
|
||||
});
|
||||
_updatePreviewUrlVisibility: function({roomId}) {
|
||||
const levels = [
|
||||
SettingLevel.ROOM_DEVICE,
|
||||
SettingLevel.ROOM_ACCOUNT,
|
||||
];
|
||||
let showUrlPreview;
|
||||
if (MatrixClientPeg.get().isRoomEncrypted(roomId)) {
|
||||
for (const level of levels) {
|
||||
const value = SettingsStore.getValueAt(level, "urlPreviewsEnabled", roomId, true, true);
|
||||
if (value === Boolean(value)) { // if is Boolean
|
||||
showUrlPreview = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
showUrlPreview = showUrlPreview || false;
|
||||
} else {
|
||||
showUrlPreview = SettingsStore.getValue("urlPreviewsEnabled", roomId);
|
||||
}
|
||||
this.setState({showUrlPreview});
|
||||
},
|
||||
|
||||
onRoom: function(room) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue