Allow restricting an instance to certain rooms #283
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #234
This change introduces config options, which allow to restrict which rooms the view bot is allowed to join & render messages from.
For the message preview, the implementation is quite straightforward:
However, if allowlists are enabled, the UX in the room directory is not perfect. My current implementation just filters out all rooms which are not allowed. However, this may leave the user with less than 9 rooms (most probably even 0) in their search result while the user still needs to press next to search further. However, this seemed a little bit better to me than showing rooms which aren’t accessible.
To avoid this bad UX for certain use cases (most probably useful if projects self-host a small instance for themselves), I introduced a setting which hides the room directory and just redirects to the first allowed room.
I tested that all changes are doing what I intended. I also tested that, with no new settings set, the site still behaves the same.