mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 19:57:18 +08:00
FIX: dont allow channel non-members to write messages in threads (#31697)
Prevents channel non-members from seeing the composer in threads. Since they do not have the correct permissions to post within the channel, we should show the join channel CTA in place of the chat composer.
This commit is contained in:
@ -34,6 +34,7 @@ import UserChatThreadMembership from "discourse/plugins/chat/discourse/models/us
|
||||
import ChatComposerThread from "./chat/composer/thread";
|
||||
import ChatScrollToBottomArrow from "./chat/scroll-to-bottom-arrow";
|
||||
import ChatSelectionManager from "./chat/selection-manager";
|
||||
import ChatChannelPreviewCard from "./chat-channel-preview-card";
|
||||
import Message from "./chat-message";
|
||||
import ChatMessagesContainer from "./chat-messages-container";
|
||||
import ChatMessagesScroller from "./chat-messages-scroller";
|
||||
@ -71,6 +72,11 @@ export default class ChatThread extends Component {
|
||||
return this.args.thread.messagesManager;
|
||||
}
|
||||
|
||||
get showChannelPreview() {
|
||||
const channel = this.args.thread.channel;
|
||||
return channel?.isCategoryChannel && !channel?.isFollowing;
|
||||
}
|
||||
|
||||
@action
|
||||
handleKeydown(event) {
|
||||
if (event.key === "Escape") {
|
||||
@ -582,13 +588,17 @@ export default class ChatThread extends Component {
|
||||
@messagesManager={{this.messagesManager}}
|
||||
/>
|
||||
{{else}}
|
||||
<ChatComposerThread
|
||||
@channel={{@channel}}
|
||||
@thread={{@thread}}
|
||||
@onSendMessage={{this.onSendMessage}}
|
||||
@uploadDropZone={{this.uploadDropZone}}
|
||||
@scroller={{this.scroller}}
|
||||
/>
|
||||
{{#if this.showChannelPreview}}
|
||||
<ChatChannelPreviewCard @channel={{@thread.channel}} />
|
||||
{{else}}
|
||||
<ChatComposerThread
|
||||
@channel={{@channel}}
|
||||
@thread={{@thread}}
|
||||
@onSendMessage={{this.onSendMessage}}
|
||||
@uploadDropZone={{this.uploadDropZone}}
|
||||
@scroller={{this.scroller}}
|
||||
/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<ChatUploadDropZone @model={{@thread}} />
|
||||
|
Reference in New Issue
Block a user