-
Notifications
You must be signed in to change notification settings - Fork 0
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
DEV: Improving mobile chat behaviour allowing interaction outside the chat modal and adding a group allow list to chat #43
base: main
Are you sure you want to change the base?
Conversation
… chat modal and adding a group allow list to chat
assets/javascripts/discourse/components/embeddable-chat-channel.gjs
Outdated
Show resolved
Hide resolved
@@ -46,4 +47,77 @@ class Engine < ::Rails::Engine | |||
DiscourseLivestream.handle_topic_chat_channel_creation(topic) | |||
end | |||
end | |||
|
|||
register_modifier(:channel_memberships) do |f, user| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand why we're doing it this way. I would have thought that the memberships would be created/updated when users join/leave the event associated with the "livestream". The users/groups allowed to join the associated chat would be controlled by the groups allowed to join the event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main problem here is the chat's behavior. Currently, users can't preview channels they can't follow. Initially, I implemented this in the guardian extension for chat but those users who couldn't follow couldn't preview the chat so it defeats the purpose of the plugin. This modifiers aim at changing the state of the membership depending on user permissions so we dont have to modify core, which was recentlyish modified to behave this way
I just came up with the solution and maybe there is a cleaner way to handle this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, users can't preview channels they can't follow.
That's not true. Users can preview all the channels they have access to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is my understanding this commit changed that, this is in the channels_controller
discourse/discourse@436b68a. It changed the guardian use of can_preview_chat_channel?
to can_join_chat_channel?
. I am not an expert here but this is what I found after following the flow of the app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I meant. If they can join a channel, they can preview it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't answer my question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The snippet of code I linked belongs to the function triggered when a user joins an event
async function onAcceptInvite({ status, chatChannelsManager, topic }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done on the server using a on(:something) do ... end
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can fix that, it would require changes in the calendar plugin as well since it lacks the event trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can fix that, it would require changes in the calendar plugin as well since it lacks the event trigger. I will create a different PR for those changes
Description
Discourse Livestream allows the user to create chat in an specific topic that contains an event allowing user interaction when a livestream is added to the topic.
Problem
Currently, users don't have a way to restrict access to this chat for users and the chat UI doesn't allow user interaction with the topic when the chat modal is open.
Solution
Allow users to use chat as a component when the
modal_mobile_chat_channel
SiteSetting
is disabled and add alivestream_chat_allowed_groups
SiteSettings
along with the required code to allow the user to control which groups of users have access to chat