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

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.

10 Likes

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 Likes

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

2 Likes

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 Like

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 Likes

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 Likes

That’s my bad, sorry @sam.

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

5 Likes

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