Public events can't be created by users who can't see TL0 group

I also have a user who cannot create an event, they get the error “An error occured: Invalid allowed groups.” and the allowed group in the event is the default trust_level_0, she is in an allowed group in the site setting discourse post event allowed on groups, any ideas?

2 Likes

I think the problem is that the trust_level_0 group on your site cannot be seen by the user, even though see is a member of it. To confirm that, can you check the Interaction tab of your site’s trust_level_0 group’s management page?

My guess is that the value of the “Who can see this group” setting will be either “Group owners and moderators” or “Group owners.” I think the plugin’s code makes the assumption that the trust_level_0 group will always be configured so that it can be seen by “Everyone.”

If this is correct, you could fix the issue for now by changing the group’s visibility setting back to its default value of “Everyone.”

This might be considered to be a bug in the plugin. When a public event is created, the code that’s used to create the event looks something like this:

[event start="2023-10-05 16:00" status="public" timezone="America/Vancouver" end="2023-10-05 17:00" allowedGroups="trust_level_0"]
[/event]

Note that the value of allowedGroups is automatically set to trust_level_0 for public events. It is possible for users to be members of the TL0 group but not be able to “see” it. In this case, these users will not be able to create public events.

For reference, the relevant code is here: discourse-calendar/lib/discourse_post_event/event_validator.rb at main · discourse/discourse-calendar · GitHub

3 Likes

That was the problem, thank you Simon!

3 Likes

I’m moving this to the bug category for now to make it easier to track. If preventing users who can’t see the TL0 group from creating public events is the intended behavior, this could be recategorized to ux.

4 Likes

That was great deduction…
Some error messages could bring more details depending on the context so we can find more easily where the issue comes from.

3 Likes