mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 09:37:57 +08:00
DEV: Pass messageId as a dynamic segment instead of a query param (#20013)
* DEV: Rnemae channel path to just c Also swap the channel id and channel slug params to be consistent with core. * linting * channel_path * Drop slugify helper and channel route without slug * Request slug and route models through the channel model if possible * DEV: Pass messageId as a dynamic segment instead of a query param * Ensure change is backwards-compatible * drop query param from oneboxes * Correctly extract channelId from routes * Better route organization using siblings for regular and near-message * Ensures sessions are unique even when using parallelism * prevents didReceiveAttrs to clear input mid test * we disable animations in capybara so sometimes the message was barely showing * adds wait * ensures finished loading * is it causing more harm than good? * this check is slowing things for no reason * actually target the button * more resilient select chat message * apply similar fix to bookmark * fix --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
@ -265,16 +265,8 @@ after_initialize do
|
||||
|
||||
if Oneboxer.respond_to?(:register_local_handler)
|
||||
Oneboxer.register_local_handler("chat/chat") do |url, route|
|
||||
queryParams =
|
||||
begin
|
||||
CGI.parse(URI.parse(url).query)
|
||||
rescue StandardError
|
||||
{}
|
||||
end
|
||||
messageId = queryParams["messageId"]&.first
|
||||
|
||||
if messageId.present?
|
||||
message = ChatMessage.find_by(id: messageId)
|
||||
if route[:message_id].present?
|
||||
message = ChatMessage.find_by(id: route[:message_id])
|
||||
next if !message
|
||||
|
||||
chat_channel = message.chat_channel
|
||||
@ -334,16 +326,8 @@ after_initialize do
|
||||
|
||||
if InlineOneboxer.respond_to?(:register_local_handler)
|
||||
InlineOneboxer.register_local_handler("chat/chat") do |url, route|
|
||||
queryParams =
|
||||
begin
|
||||
CGI.parse(URI.parse(url).query)
|
||||
rescue StandardError
|
||||
{}
|
||||
end
|
||||
messageId = queryParams["messageId"]&.first
|
||||
|
||||
if messageId.present?
|
||||
message = ChatMessage.find_by(id: messageId)
|
||||
if route[:message_id].present?
|
||||
message = ChatMessage.find_by(id: route[:message_id])
|
||||
next if !message
|
||||
|
||||
chat_channel = message.chat_channel
|
||||
@ -655,6 +639,7 @@ after_initialize do
|
||||
|
||||
base_c_route = "/c/:channel_title/:channel_id"
|
||||
get base_c_route => "chat#respond", :as => "channel"
|
||||
get "#{base_c_route}/:message_id" => "chat#respond"
|
||||
|
||||
%w[info info/about info/members info/settings].each do |route|
|
||||
get "#{base_c_route}/#{route}" => "chat#respond"
|
||||
|
Reference in New Issue
Block a user