discourse/plugins/chat/lib/chat_message_processor.rb
Martin Brennan baf78d3d91
FIX: Add missing user_id args for ChatMessage.cook (#19508)
In both ChatMessage#rebake! and in ChatMessageProcessor
when we were calling ChatMessage.cook we were missing the
user_id to cook with, which causes missed hashtag cooks
because of missing permissions.
2022-12-19 11:05:37 +10:00

34 lines
630 B
Ruby

# frozen_string_literal: true
class Chat::ChatMessageProcessor
include ::CookedProcessorMixin
def initialize(chat_message)
@model = chat_message
@previous_cooked = (chat_message.cooked || "").dup
@with_secure_uploads = false
@size_cache = {}
@opts = {}
cooked = ChatMessage.cook(chat_message.message, user_id: chat_message.last_editor_id)
@doc = Loofah.fragment(cooked)
end
def run!
post_process_oneboxes
DiscourseEvent.trigger(:chat_message_processed, @doc, @model)
end
def large_images
[]
end
def broken_images
[]
end
def downloaded_images
{}
end
end