From dd9059917fc5054712c8dcd1ec9a81bbcedfdc95 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Mon, 13 Feb 2023 10:40:14 +1000 Subject: [PATCH] DEV: Review fixes --- .../app/controllers/api/chat_channel_threads_controller.rb | 4 +--- .../javascripts/discourse/routes/chat-channel-thread.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/chat/app/controllers/api/chat_channel_threads_controller.rb b/plugins/chat/app/controllers/api/chat_channel_threads_controller.rb index d2fd7a6871..920588dbda 100644 --- a/plugins/chat/app/controllers/api/chat_channel_threads_controller.rb +++ b/plugins/chat/app/controllers/api/chat_channel_threads_controller.rb @@ -12,9 +12,7 @@ class Chat::Api::ChatChannelThreadsController < Chat::Api .includes(:channel) .includes(original_message_user: :user_status) .includes(original_message: :chat_webhook_event) - .find(params[:thread_id]) - - raise Discourse::NotFound if thread.channel_id != params[:channel_id].to_i + .find_by!(id: params[:thread_id], channel_id: params[:channel_id]) guardian.ensure_can_preview_chat_channel!(thread.channel) diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat-channel-thread.js b/plugins/chat/assets/javascripts/discourse/routes/chat-channel-thread.js index 9713ec0bdc..8621dc311d 100644 --- a/plugins/chat/assets/javascripts/discourse/routes/chat-channel-thread.js +++ b/plugins/chat/assets/javascripts/discourse/routes/chat-channel-thread.js @@ -9,7 +9,7 @@ export default class ChatChannelThread extends DiscourseRoute { async model(params) { return this.chatThreadsManager.find( - this.chat.activeChannel.id, + this.modelFor("chat.channel").id, params.threadId ); }