Composer shortcut should be disabled if user isn't allowed to post

AI-generated summary

The discussion addresses a bug where the composer shortcut opens even when a user is not allowed to post. HAWK reports that the composer should not open in such cases. jomaxro references a prior report about closed topics and clarifies that this issue is broader. codinghorror highlights the need for a fix, and sam explains the technical challenge: permission checks are tied to category context, not the user’s general ability to create topics. A fix was implemented in commit e756d02 for topic creation. SidV notes that the issue also affects closed topics when using SHIFT + R, prompting sam to address it separately. A second fix was applied in commit 252cbd8, resolving both issues. jomaxro acknowledges the merge was premature, but sam confirms the outcome is better with two bugs fixed instead of one.

In cases where a member isn’t allowed to post, the composer should not open under any circumstances.

Currently if TL settings are set so that TL0 isn’t allowed to post, hitting C opens the composer window.

11 „Gefällt mir“

This was reported a week ago by @SidV in Composer appears when the topic is closed, which was specific to closed topics. Closed the other topic as this report is broader.

3 „Gefällt mir“

We should fix this @sam. Why is it avoiding the normal code paths here? This smells bad.

2 „Gefällt mir“

Cause it does this:

 createTopic() {
    this.container.lookup('controller:composer').open({action: Composer.CREATE_TOPIC, draftKey: Composer.CREATE_TOPIC});
  },

The permission itself is attached to the topic list serializer and category topic list serializer cause “can create topic” actually means “can create topic in current category” when you are drilled into a category. This info is not available when you are looking at a topic.

Current user serializer does not have a general “can create topics” on the forum. We would have to add it there.

1 „Gefällt mir“

Ok so this would need to be a 2.0 fix? Can the composer itself do a check and disable itself if it does not end up having permissions? Since composer is doing http calls anyways

Fixed per:

https://github.com/discourse/discourse/commit/e756d020881b3a60122bd76ac740e5aaae028c21

5 „Gefällt mir“

Sam, that fixes only for creating topic, isn’t it?
Because on closed topics, if I press SHIFT + R, the composer appears.

That is a different bug though… hmmm not sure it was right to merge the two.

Will fix as well…

Fixed per:

https://github.com/discourse/discourse/commit/252cbd8635ab6b5dd66be856ba4a2c1f8f862dd1

3 „Gefällt mir“

That’s my bad, sorry @sam.

For the best anyway cause now we have 2 less bugs instead of just 1

6 „Gefällt mir“

This topic was automatically closed after 30 hours. New replies are no longer allowed.