DEV: applies chat namespacing (#12)
This commit is contained in:
parent
75aa595105
commit
edfdc6dfae
|
@ -17,7 +17,7 @@ class ReviewableAiChatMessage < Reviewable
|
|||
end
|
||||
|
||||
def chat_message
|
||||
@chat_message ||= (target || ChatMessage.with_deleted.find_by(id: target_id))
|
||||
@chat_message ||= (target || Chat::Message.with_deleted.find_by(id: target_id))
|
||||
end
|
||||
|
||||
def chat_message_creator
|
||||
|
|
|
@ -7,7 +7,7 @@ module ::Jobs
|
|||
|
||||
return if (chat_message_id = args[:chat_message_id]).blank?
|
||||
|
||||
chat_message = ChatMessage.find_by(id: chat_message_id)
|
||||
chat_message = ::Chat::Message.find_by(id: chat_message_id)
|
||||
return if chat_message&.message.blank?
|
||||
|
||||
DiscourseAi::ChatMessageClassificator.new(
|
||||
|
|
|
@ -59,7 +59,7 @@ module DiscourseAi
|
|||
end
|
||||
|
||||
def content_of(target_to_classify)
|
||||
return target_to_classify.message if target_to_classify.is_a?(ChatMessage)
|
||||
return target_to_classify.message if target_to_classify.is_a?(Chat::Message)
|
||||
|
||||
if target_to_classify.post_number == 1
|
||||
"#{target_to_classify.topic.title}\n#{target_to_classify.raw}"
|
||||
|
|
|
@ -59,7 +59,7 @@ module ::DiscourseAi
|
|||
{
|
||||
model_used: model_name,
|
||||
target_id: target.id,
|
||||
target_type: target.class.name,
|
||||
target_type: target.class.sti_name,
|
||||
classification_type: classification_model.type,
|
||||
classification: classifications,
|
||||
updated_at: DateTime.now,
|
||||
|
|
|
@ -39,7 +39,7 @@ describe DiscourseAi::Toxicity::EntryPoint do
|
|||
context "when creating a chat message" do
|
||||
let(:public_chat_channel) { Fabricate(:chat_channel) }
|
||||
let(:creator) do
|
||||
Chat::ChatMessageCreator.new(
|
||||
Chat::MessageCreator.new(
|
||||
chat_channel: public_chat_channel,
|
||||
user: user,
|
||||
content: "This is my new test",
|
||||
|
@ -54,7 +54,7 @@ describe DiscourseAi::Toxicity::EntryPoint do
|
|||
context "when editing a chat message" do
|
||||
let(:chat_message) { Fabricate(:chat_message) }
|
||||
let(:updater) do
|
||||
Chat::ChatMessageUpdater.new(
|
||||
Chat::MessageUpdater.new(
|
||||
guardian: Guardian.new(chat_message.user),
|
||||
chat_message: chat_message,
|
||||
new_content: "This is my updated message",
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe ReviewableAiChatMessage, type: :model do
|
|||
reviewable.perform(moderator, :agree_and_delete)
|
||||
|
||||
expect(reviewable).to be_approved
|
||||
expect(ChatMessage.with_deleted.find_by(id: chat_message_id).deleted_at).to be_present
|
||||
expect(Chat::Message.with_deleted.find_by(id: chat_message_id).deleted_at).to be_present
|
||||
end
|
||||
|
||||
it "agree_and_restore agrees with the flag and restores the message" do
|
||||
|
|
Loading…
Reference in New Issue