A platform for community discussion. Free, open, simple.
DEV: removes dead code (message_link) (#24648)
Joffrey JAFFEUXa1690e0401fa
diff --git a/plugins/chat/app/controllers/chat/chat_controller.rb b/plugins/chat/app/controllers/chat/chat_controller.rbindex fd13052c63e..83ab410338d 100644--- a/plugins/chat/app/controllers/chat/chat_controller.rb+++ b/plugins/chat/app/controllers/chat/chat_controller.rb@@ -5,9 +5,9 @@ module Chat# Other endpoints use set_channel_and_chatable_with_access_check, but# these endpoints require a standalone find because they need to be# able to get deleted channels and recover them.- before_action :find_chat_message, only: %i[rebake message_link]+ before_action :find_chat_message, only: %i[rebake]before_action :set_channel_and_chatable_with_access_check,- except: %i[respond message_link set_user_chat_status dismiss_retention_reminder]+ except: %i[respond set_user_chat_status dismiss_retention_reminder]def respondrender@@ -32,17 +32,6 @@ module Chatrender json: success_jsonend- def message_link- raise Discourse::NotFound if @message.blank? || @message.deleted_at.present?- raise Discourse::NotFound if @message.chat_channel.blank?- set_channel_and_chatable_with_access_check(chat_channel_id: @message.chat_channel_id)- render json:- success_json.merge(- chat_channel_id: @chat_channel.id,- chat_channel_title: @chat_channel.title(current_user),- )- end-def set_user_chat_statusparams.require(:chat_enabled)diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat-message.js b/plugins/chat/assets/javascripts/discourse/routes/chat-message.jsdeleted file mode 100644index b7b7f31f7ab..00000000000--- a/plugins/chat/assets/javascripts/discourse/routes/chat-message.js+++ /dev/null@@ -1,28 +0,0 @@-import { inject as service } from "@ember/service";-import { ajax } from "discourse/lib/ajax";-import { defaultHomepage } from "discourse/lib/utilities";-import DiscourseRoute from "discourse/routes/discourse";--export default class ChatMessageRoute extends DiscourseRoute {- @service chat;- @service router;-- async model(params) {- return ajax(`/chat/message/${params.messageId}.json`)- .then((response) => {- this.router.transitionTo(- "chat.channel.near-message",- response.chat_channel_title,- response.chat_channel_id,- params.messageId- );- })- .catch(() => this.router.replaceWith("/404"));- }-- beforeModel() {- if (!this.chat.userCanChat) {- return this.router.transitionTo(`discovery.${defaultHomepage()}`);- }- }-}diff --git a/plugins/chat/config/routes.rb b/plugins/chat/config/routes.rbindex c0ff0d65b03..c3dd707746e 100644--- a/plugins/chat/config/routes.rb+++ b/plugins/chat/config/routes.rb@@ -78,7 +78,6 @@ Chat::Engine.routes.draw doget "/browse/open" => "chat#respond"get "/browse/archived" => "chat#respond"post "/dismiss-retention-reminder" => "chat#dismiss_retention_reminder"- get "/message/:message_id" => "chat#message_link"put ":chat_channel_id/react/:message_id" => "chat#react"put "/:chat_channel_id/:message_id/rebake" => "chat#rebake"post "/:chat_channel_id/quote" => "chat#quote_messages"diff --git a/plugins/chat/spec/requests/chat_controller_spec.rb b/plugins/chat/spec/requests/chat_controller_spec.rbindex e619fcd2087..2aa353b7d63 100644--- a/plugins/chat/spec/requests/chat_controller_spec.rb+++ b/plugins/chat/spec/requests/chat_controller_spec.rb@@ -453,16 +453,4 @@ RSpec.describe Chat::ChatController doEXPECTEDendend-- describe "#message_link" do- it "ensures message's channel can be seen" do- channel = Fabricate(:category_channel, chatable: Fabricate(:category))- message = Fabricate(:chat_message, chat_channel: channel)-- Guardian.any_instance.expects(:can_join_chat_channel?).with(channel)-- sign_in(Fabricate(:user))- get "/chat/message/#{message.id}.json"- end- endend