"Arrive at topic" invite permissions issue

Summary:

If the option “Arrive at topic” is used in an invite, weird permissions issues happen.

Reproduction:

  1. create a group specialgroup
  2. set up a category testcategory
  3. add groups trust_level_0 and specialgroup, both as See/Reply/Create*
  4. create a topic in that category
  5. create an invite and set “arrive at topic” to the topic created in step 4

  1. sigh
  2. remove specialgroup from the category permissions for now, so the category only has trust_level_0 as See/Reply/Create
  3. try to create the invite again and set “arrive at topic” to the topic created in step 4
  4. see how things actually got worse

  1. be smart and try to set the category permissions to logged_in_users instead of trust_level_0
  2. learn that this does not make a difference

May be related

Variant on Invite link to private group, arrive at topic (private category) not working. This time it goes south during invite link creation.

*) it sounds like it does not make sense to have both groups but if you have a subcategory that only allows specialgroup, you must add that group to the parent category as well, because Discourse does not understand that trust_level_0 is always a superset.