DEV: applies chat namespacing (#12)

This commit is contained in:
Joffrey JAFFEUX 2023-03-17 15:15:38 +01:00 committed by GitHub
parent 75aa595105
commit edfdc6dfae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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(

View File

@ -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}"

View File

@ -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,

View File

@ -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",

View File

@ -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