session-desktop
session-desktop copied to clipboard
Allow the user to control whether messages from blocked users are filtered from open groups.
Contributor checklist:
- [x] My commits are in nice logical chunks with good commit messages
- [x] My changes are rebased on the latest
clearnet
branch - [x] A
yarn ready
run passes successfully (more about tests here) - [x] My changes are ready to be shipped to users
Description
Currently, the messages of blocked users are discarded at fetch time from open groups. This can seriously disturb the flow of open groups in which a blocked user is a frequent contributor, and the user has no control over this behaviour. His only recourse if to unblock such users.
This patch makes it possible to turn off the open group filtration of messages from blocked users. It also defers the point of filtration until display time, making it non-destructive. Filtration of previously received messages can thus be undone at any time by simply disabling the feature in Settings.
Finally, I noticed that messages from blocked users were not being filtered from private conversations and closed groups. Blocked conversations were also not indicated as such in search results. This patch also fixes those problems.

Sounds good, can you clarify
Finally, I noticed that messages from blocked users were not being filtered from private conversations and closed groups
Do you mean that with this patch Session will not show messages from blocked users in 1-1s and Closed groups?
Blocked conversations were also not indicated as such in search results. This patch also fixes those problems.
How is this indicated visually?
Do you mean that with this patch Session will not show messages from blocked users in 1-1s and Closed groups?
Yes, but regardless of the toggle setting. That's inconsistent behaviour, though, so perhaps the toggle should govern all convos, not just open groups. Thoughts?
In 1-1s, you will see only your own side of the conversation. I know that's not terribly useful, but the reason I didn't treat it specially because I think most users actually delete the convos that they block.
Closed groups use the same code, so blocked users will be filtered from those also.
Blocked conversations were also not indicated as such in search results. This patch also fixes those problems.
How is this indicated visually?
It just triggers the same code that you apply elsewhere to blocked convos, which essentially just seems to place a vertical red bar down the left border:

(I had to block you to illustrate the concept. 😀)
I think we should show messages from the offending party before their blocking in all conversations, after being blocked, in 1-1s and closed groups we shouldn't show future messages from the blocked individual. But we should allow the user to see messages from blocked users in open groups (with a toggle switch)
I think we should show messages from the offending party before their blocking in all conversations,
That's kind of tricky, because the block is not currently timestamped, so we don't know when it went into effect. All we know is that a user is blocked or not, but not since when.
after being blocked, in 1-1s and closed groups we shouldn't show future messages from the blocked individual. But we should allow the user to see messages from blocked users in open groups (with a toggle switch)
OK, so that's the behaviour I've implemented. Blocked users have their messages removed from 1-to-1s and from closed groups, regardless of the toggle. The toggle is used only for open groups, to allow the user to override the block and see the messages of blocked users there.
I think a database change would be required in order to make decisions based on when a block was last added or removed; or maybe it's possible to pull the timestamp of the last row update. I don't know about that, but it's not surfaced in the code at present, at least.
Due to the adoption of ID blinding in communities, this PR is now rendered non-functional. The current default behavior, as a result of ID blinding, is that when a user is blocked, their messages remain visible within communities. This is because the block action targets the actual Session ID, not the blinded ID that is used within the group. To address this issue, the PR needs to be restructured to associate a user's Session ID with their blinded ID, thereby enabling the blocking of messages from that blinded ID in communities.
Ideally, the default behavior should ensure that once a user is blocked, their messages become invisible in communities, 1-1s and closed groups. But the PR should add an opt-in toggle allowing users to choose to see messages from blocked individuals in communities again. Implementing this feature will necessitate modifications to the current PR.
Closing this for now, for reasons stated above, would need to quite extensively refactor this PR to support this toggle for blinded and non blinded ID's, tracking this change internally via SES-2468