Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible granular settings bug on url previews #6205

Closed
ara4n opened this issue Feb 18, 2018 · 13 comments
Closed

possible granular settings bug on url previews #6205

ara4n opened this issue Feb 18, 2018 · 13 comments
Labels
A-Room-Settings A-User-Settings P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter

Comments

@ara4n
Copy link
Member

ara4n commented Feb 18, 2018

richvdh disabled url previews in the matrix ops room. however, my client continued to show them, claiming i'd explicitly manually enabled them for that room. i'm pretty sure i hadn't.

@turt2live
Copy link
Member

turt2live commented Feb 18, 2018

@ara4n can you run this bit of js for me? Replacing the targetRoomId with the correct room ID of course:

(function(){
    // urlPreviewsEnabled
    // ['device', 'room-device', 'room-account', 'account', 'config', 'room']

    var targetRoomId = '!JuIwrfKPKiEVFIGqcj:t2l.io';
    var targetRoom = mxMatrixClientPeg.get().getRoom(targetRoomId);

    var previewsAtDevice = JSON.parse((localStorage.getItem("mx_local_settings") || "{}"))["urlPreviewsEnabled"];
    var previewsAtRoomDevice = JSON.parse((localStorage.getItem("mx_setting_urlPreviewsEnabled_" + targetRoomId) || "{}"))['value'];
    var previewsAtRoomAccount = targetRoom ? !(targetRoom.getAccountData("org.matrix.room.preview_urls") || {getContent:function(){return {};}}).getContent()['disable'] : undefined;
    var previewsAtAccount = !(mxMatrixClientPeg.get().getAccountData("org.matrix.preview_urls") || {getContent:function(){return {};}}).getContent()['disable'];
    var previewsAtConfig = ((mxReactSdkConfig || {})["settingDefaults"] || {})["urlPreviewsEnabled"];
    var previewsAtRoom = targetRoom ? !(targetRoom.currentState.getStateEvents("org.matrix.room.preview_urls", "") || {getContent:function(){return{};}}).getContent()['disable'] : undefined;

    console.log("urlPreviewsEnabled @ device = " + previewsAtDevice);
    console.log("urlPreviewsEnabled @ room-device = " + previewsAtRoomDevice);
    console.log("urlPreviewsEnabled @ room-account = " + previewsAtRoomAccount);
    console.log("urlPreviewsEnabled @ account = " + previewsAtAccount);
    console.log("urlPreviewsEnabled @ config = " + previewsAtConfig);
    console.log("urlPreviewsEnabled @ room = " + previewsAtRoom);
})();

All it does is pull the values that Granular Settings should be pulling, just in a more direct way.

Edited: fixed a bug with getting state events

@ara4n
Copy link
Member Author

ara4n commented Feb 18, 2018

so i've already had to override my local pref for that room in order to get rid of the url previews, so the data is probably no longer correct:

18:22:17.538 rageshake.js:65 urlPreviewsEnabled @ device = undefined
18:22:17.539 rageshake.js:65 urlPreviewsEnabled @ room-device = undefined
18:22:17.539 rageshake.js:65 urlPreviewsEnabled @ room-account = false
18:22:17.539 rageshake.js:65 urlPreviewsEnabled @ account = true
18:22:17.539 rageshake.js:65 urlPreviewsEnabled @ config = undefined
18:22:17.540 rageshake.js:65 urlPreviewsEnabled @ room = false

@turt2live
Copy link
Member

So it looks like what was happening was the account setting of "always show previews" was used because it was an explicit "true". With the levels ordering, this is expected.

Url previews are kinda subjective as to what the ordering should be. In your case, it seems the desired choice is the room setting, however for other rooms people want to show previews anyways, regardless of the room setting.

@ara4n
Copy link
Member Author

ara4n commented Feb 18, 2018

hm, so my account default setting of true overrode the room's state config of false? This feels very surprising...

@turt2live
Copy link
Member

tbh it'd be surprising under different circumstances if the order was flipped. I'd be interested as to what others think though.

@lampholder lampholder added T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter A-Room-Settings A-User-Settings P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels Feb 21, 2018
@lampholder
Copy link
Member

lampholder commented Feb 21, 2018

Bug isnt't really the right label for this - the state is more 'discussion required'.

@lukebarnard1
Copy link
Contributor

lukebarnard1 commented Feb 21, 2018

I would say that room-account should override the room. @turt2live what is the order of precedence here?..

so i've already had to override my local pref for that room in order to get rid of the url previews, so the data is probably no longer correct:

oh, Matthew says that this is being honoured at least

@lukebarnard1
Copy link
Contributor

Url previews are kinda subjective as to what the ordering should be

I really hope the ordering is the same for any setting! If that's not true, the model of granularity might need a rethink to combat complexity like this.

@turt2live
Copy link
Member

The order is the same as the JS output:

['device', 'room-device', 'room-account', 'account', 'config', 'room']

This is the same order for everything that has LEVELS_ROOM_SETTINGS_WITH_ROOM ( https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.js#L27 ).

The room has always been designed to come after the account so that the user has more control over their client. For instance, if a room dictates that it should be tinted red, but the user wants all their rooms to be blue then the rooms should be blue. Similarly, for URL previews a user may want to globally disable them (or globally enable them) for their account. The intent is to always give the user's choice precedence over someone else's.

The config level was the only one that had actually shifted position between the initial design and merge (all the other changes were done prior to the initial design). This was because the build config ended up being more useful to target a group of users (everyone on the instance), and therefore has a narrow scope compared to a room (which targets everyone) in a way. It doesn't mean much for instances like riot.im/app because the config affects many more people than a room would, however people running a private instance would generally want to pick sensible defaults for their users (such as communities where they deem avatar changes too noisy and disable them by default for everyone). For reference, it was originally [account, room, config]. This was changed to be [account, config, room] for the reasons described.

Back to why room comes after account though: The whole idea is to prevent room admins from making your client behave in a way that is completely unexpected or not desired. The same applies for why room admins can only change 6 of the settings in their room (url previews, tint, hiding redactions, hiding join/leave events, hiding avatar changes, and hiding display name changes).

More review is probably needed, but I thought I should actually just dump the reasoning here instead of hinting at it over and over.

@lukebarnard1
Copy link
Contributor

@turt2live, I have a separate question: If I haven't ever changed the setting at any level, presumably it takes the default value. But there seemingly isn't a way to revert a setting to "default" as in "use the previous setting by precedence"? I feel like part of the confusion could be coming from this; the checkbox UI isn't really suited to this kind of data (it needs a pass-thru setting).

@turt2live
Copy link
Member

Correct, riot doesn't provide unsetting it. The intent of the original system was to have very little UX impact because tri-state checkboxes could be confusing. I think @lampholder had thoughts on how the UX of granular settings could work

@t3chguy
Copy link
Member

t3chguy commented Jun 22, 2018

This may have been originally caused by a typo in GranularSettings which was fixed by matrix-org/matrix-react-sdk@d1600bd

@t3chguy
Copy link
Member

t3chguy commented May 12, 2019

I believe this was fixed above, re-open if ever reproduced

@t3chguy t3chguy closed this as completed May 12, 2019
williamkray pushed a commit to williamkray/element-web that referenced this issue Aug 2, 2021
* Sanitize untrusted variables from message previews before translation
Fixes element-hq#18314
* Fix editing of `<sub>` & `<sup`> & `<u>`
[\element-hq#6469](matrix-org/matrix-react-sdk#6469)
Fixes element-hq#18211
* Zoom images in lightbox to where the cursor points
[\element-hq#6418](matrix-org/matrix-react-sdk#6418)
Fixes element-hq#17870
* Avoid hitting the settings store from TextForEvent
[\element-hq#6205](matrix-org/matrix-react-sdk#6205)
Fixes element-hq#17650
* Initial MSC3083 + MSC3244 support
[\element-hq#6212](matrix-org/matrix-react-sdk#6212)
Fixes element-hq#17686 and element-hq#17661
* Navigate to the first room with notifications when clicked on space notification dot
[\element-hq#5974](matrix-org/matrix-react-sdk#5974)
* Add matrix: to the list of permitted URL schemes
[\element-hq#6388](matrix-org/matrix-react-sdk#6388)
* Add "Copy Link" to room context menu
[\element-hq#6374](matrix-org/matrix-react-sdk#6374)
* 💭 Message bubble layout
[\element-hq#6291](matrix-org/matrix-react-sdk#6291)
Fixes element-hq#4635, element-hq#17773 element-hq#16220 and element-hq#7687
* Play only one audio file at a time
[\#6417](matrix-org/matrix-react-sdk#6417)
Fixes element-hq#17439
* Move download button for media to the action bar
[\element-hq#6386](matrix-org/matrix-react-sdk#6386)
Fixes element-hq#17943
* Improved display of one-to-one call history with summary boxes for each call
[\element-hq#6121](matrix-org/matrix-react-sdk#6121)
Fixes element-hq#16409
* Notification settings UI refresh
[\element-hq#6352](matrix-org/matrix-react-sdk#6352)
Fixes element-hq#17782
* Fix EventIndex double handling events and erroring
[\element-hq#6385](matrix-org/matrix-react-sdk#6385)
Fixes element-hq#18008
* Improve reply rendering
[\element-hq#3553](matrix-org/matrix-react-sdk#3553)
Fixes element-hq#9217, element-hq#7633, element-hq#7530, element-hq#7169, element-hq#7151, element-hq#6692 element-hq#6579 and element-hq#17440
* Improve performance of room name calculation
[\element-hq#1801](matrix-org/matrix-js-sdk#1801)
* Fix browser history getting stuck looping back to the same room
[\element-hq#18053](element-hq#18053)
* Fix space shortcuts on layouts with non-English keys in the places of numbers
[\element-hq#17780](element-hq#17780)
Fixes element-hq#17776
* Fix CreateRoomDialog exploding when making public room outside of a space
[\element-hq#6493](matrix-org/matrix-react-sdk#6493)
* Fix regression where registration would soft-crash on captcha
[\element-hq#6505](matrix-org/matrix-react-sdk#6505)
Fixes element-hq#18284
* only send join rule event if we have a join rule to put in it
[\element-hq#6517](matrix-org/matrix-react-sdk#6517)
* Improve the new download button's discoverability and interactions.
[\element-hq#6510](matrix-org/matrix-react-sdk#6510)
* Fix voice recording UI looking broken while microphone permissions are being requested.
[\element-hq#6479](matrix-org/matrix-react-sdk#6479)
Fixes element-hq#18223
* Match colors of room and user avatars in DMs
[\element-hq#6393](matrix-org/matrix-react-sdk#6393)
Fixes element-hq#2449
* Fix onPaste handler to work with copying files from Finder
[\element-hq#5389](matrix-org/matrix-react-sdk#5389)
Fixes element-hq#15536 and element-hq#16255
* Fix infinite pagination loop when offline
[\element-hq#6478](matrix-org/matrix-react-sdk#6478)
Fixes element-hq#18242
* Fix blurhash rounded corners missing regression
[\element-hq#6467](matrix-org/matrix-react-sdk#6467)
Fixes element-hq#18110
* Fix position of the space hierarchy spinner
[\element-hq#6462](matrix-org/matrix-react-sdk#6462)
Fixes element-hq#18182
* Fix display of image messages that lack thumbnails
[\element-hq#6456](matrix-org/matrix-react-sdk#6456)
Fixes element-hq#18175
* Fix crash with large audio files.
[\element-hq#6436](matrix-org/matrix-react-sdk#6436)
Fixes element-hq#18149
* Make diff colors in codeblocks more pleasant
[\element-hq#6355](matrix-org/matrix-react-sdk#6355)
Fixes element-hq#17939
* Show the correct audio file duration while loading the file.
[\element-hq#6435](matrix-org/matrix-react-sdk#6435)
Fixes element-hq#18160
* Fix various timeline settings not applying immediately.
[\element-hq#6261](matrix-org/matrix-react-sdk#6261)
Fixes element-hq#17748
* Fix issues with room list duplication
[\element-hq#6391](matrix-org/matrix-react-sdk#6391)
Fixes element-hq#14508
* Fix grecaptcha throwing useless error sometimes
[\element-hq#6401](matrix-org/matrix-react-sdk#6401)
Fixes element-hq#15142
* Update Emojibase and Twemoji and switch to IamCal (Slack-style) shortcodes
[\element-hq#6347](matrix-org/matrix-react-sdk#6347)
Fixes element-hq#13857 and element-hq#13334
* Respect compound emojis in default avatar initial generation
[\element-hq#6397](matrix-org/matrix-react-sdk#6397)
Fixes element-hq#18040
* Fix bug where the 'other homeserver' field in the server selection dialog would become briefly focus and then unfocus when clicked.
[\element-hq#6394](matrix-org/matrix-react-sdk#6394)
Fixes element-hq#18031
* Standardise spelling and casing of homeserver, identity server, and integration manager
[\element-hq#6365](matrix-org/matrix-react-sdk#6365)
* Fix widgets not receiving decrypted events when they have permission.
[\element-hq#6371](matrix-org/matrix-react-sdk#6371)
Fixes element-hq#17615
* Prevent client hangs when calculating blurhashes
[\element-hq#6366](matrix-org/matrix-react-sdk#6366)
Fixes element-hq#17945
* Exclude state events from widgets reading room events
[\element-hq#6378](matrix-org/matrix-react-sdk#6378)
* Cache feature_spaces\* flags to improve performance
[\element-hq#6381](matrix-org/matrix-react-sdk#6381)
BBaoVanC added a commit to boba-best/element.boba.best that referenced this issue Aug 3, 2021
* Sanitize untrusted variables from message previews before translation
Fixes element-hq#18314
* Fix editing of `<sub>` & `<sup`> & `<u>`
[\element-hq#6469](matrix-org/matrix-react-sdk#6469)
Fixes element-hq#18211
* Zoom images in lightbox to where the cursor points
[\element-hq#6418](matrix-org/matrix-react-sdk#6418)
Fixes element-hq#17870
* Avoid hitting the settings store from TextForEvent
[\element-hq#6205](matrix-org/matrix-react-sdk#6205)
Fixes element-hq#17650
* Initial MSC3083 + MSC3244 support
[\element-hq#6212](matrix-org/matrix-react-sdk#6212)
Fixes element-hq#17686 and element-hq#17661
* Navigate to the first room with notifications when clicked on space notification dot
[\element-hq#5974](matrix-org/matrix-react-sdk#5974)
* Add matrix: to the list of permitted URL schemes
[\element-hq#6388](matrix-org/matrix-react-sdk#6388)
* Add "Copy Link" to room context menu
[\element-hq#6374](matrix-org/matrix-react-sdk#6374)
* 💭 Message bubble layout
[\element-hq#6291](matrix-org/matrix-react-sdk#6291)
Fixes element-hq#4635, element-hq#17773 element-hq#16220 and element-hq#7687
* Play only one audio file at a time
[\#6417](matrix-org/matrix-react-sdk#6417)
Fixes element-hq#17439
* Move download button for media to the action bar
[\element-hq#6386](matrix-org/matrix-react-sdk#6386)
Fixes element-hq#17943
* Improved display of one-to-one call history with summary boxes for each call
[\element-hq#6121](matrix-org/matrix-react-sdk#6121)
Fixes element-hq#16409
* Notification settings UI refresh
[\element-hq#6352](matrix-org/matrix-react-sdk#6352)
Fixes element-hq#17782
* Fix EventIndex double handling events and erroring
[\element-hq#6385](matrix-org/matrix-react-sdk#6385)
Fixes element-hq#18008
* Improve reply rendering
[\element-hq#3553](matrix-org/matrix-react-sdk#3553)
Fixes element-hq#9217, element-hq#7633, element-hq#7530, element-hq#7169, element-hq#7151, element-hq#6692 element-hq#6579 and element-hq#17440
* Improve performance of room name calculation
[\element-hq#1801](matrix-org/matrix-js-sdk#1801)
* Fix browser history getting stuck looping back to the same room
[\element-hq#18053](element-hq#18053)
* Fix space shortcuts on layouts with non-English keys in the places of numbers
[\element-hq#17780](element-hq#17780)
Fixes element-hq#17776
* Fix CreateRoomDialog exploding when making public room outside of a space
[\element-hq#6493](matrix-org/matrix-react-sdk#6493)
* Fix regression where registration would soft-crash on captcha
[\element-hq#6505](matrix-org/matrix-react-sdk#6505)
Fixes element-hq#18284
* only send join rule event if we have a join rule to put in it
[\element-hq#6517](matrix-org/matrix-react-sdk#6517)
* Improve the new download button's discoverability and interactions.
[\element-hq#6510](matrix-org/matrix-react-sdk#6510)
* Fix voice recording UI looking broken while microphone permissions are being requested.
[\element-hq#6479](matrix-org/matrix-react-sdk#6479)
Fixes element-hq#18223
* Match colors of room and user avatars in DMs
[\element-hq#6393](matrix-org/matrix-react-sdk#6393)
Fixes element-hq#2449
* Fix onPaste handler to work with copying files from Finder
[\element-hq#5389](matrix-org/matrix-react-sdk#5389)
Fixes element-hq#15536 and element-hq#16255
* Fix infinite pagination loop when offline
[\element-hq#6478](matrix-org/matrix-react-sdk#6478)
Fixes element-hq#18242
* Fix blurhash rounded corners missing regression
[\element-hq#6467](matrix-org/matrix-react-sdk#6467)
Fixes element-hq#18110
* Fix position of the space hierarchy spinner
[\element-hq#6462](matrix-org/matrix-react-sdk#6462)
Fixes element-hq#18182
* Fix display of image messages that lack thumbnails
[\element-hq#6456](matrix-org/matrix-react-sdk#6456)
Fixes element-hq#18175
* Fix crash with large audio files.
[\element-hq#6436](matrix-org/matrix-react-sdk#6436)
Fixes element-hq#18149
* Make diff colors in codeblocks more pleasant
[\element-hq#6355](matrix-org/matrix-react-sdk#6355)
Fixes element-hq#17939
* Show the correct audio file duration while loading the file.
[\element-hq#6435](matrix-org/matrix-react-sdk#6435)
Fixes element-hq#18160
* Fix various timeline settings not applying immediately.
[\element-hq#6261](matrix-org/matrix-react-sdk#6261)
Fixes element-hq#17748
* Fix issues with room list duplication
[\element-hq#6391](matrix-org/matrix-react-sdk#6391)
Fixes element-hq#14508
* Fix grecaptcha throwing useless error sometimes
[\element-hq#6401](matrix-org/matrix-react-sdk#6401)
Fixes element-hq#15142
* Update Emojibase and Twemoji and switch to IamCal (Slack-style) shortcodes
[\element-hq#6347](matrix-org/matrix-react-sdk#6347)
Fixes element-hq#13857 and element-hq#13334
* Respect compound emojis in default avatar initial generation
[\element-hq#6397](matrix-org/matrix-react-sdk#6397)
Fixes element-hq#18040
* Fix bug where the 'other homeserver' field in the server selection dialog would become briefly focus and then unfocus when clicked.
[\element-hq#6394](matrix-org/matrix-react-sdk#6394)
Fixes element-hq#18031
* Standardise spelling and casing of homeserver, identity server, and integration manager
[\element-hq#6365](matrix-org/matrix-react-sdk#6365)
* Fix widgets not receiving decrypted events when they have permission.
[\element-hq#6371](matrix-org/matrix-react-sdk#6371)
Fixes element-hq#17615
* Prevent client hangs when calculating blurhashes
[\element-hq#6366](matrix-org/matrix-react-sdk#6366)
Fixes element-hq#17945
* Exclude state events from widgets reading room events
[\element-hq#6378](matrix-org/matrix-react-sdk#6378)
* Cache feature_spaces\* flags to improve performance
[\element-hq#6381](matrix-org/matrix-react-sdk#6381)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Room-Settings A-User-Settings P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter
Projects
None yet
Development

No branches or pull requests

5 participants