mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 03:53:51 +08:00
e1ae32103d
This is extracted from #22390. This patch aims to ease the transition to the new message creation service. (in progress in #22390) Indeed, the new service patch is breaking some specs from `discourse-ai` and `discourse-templates` because these plugins are using either `Chat::MessageCreator` or the `chat_message` fabricator. This patch addresses theses issues by normalizing how we create a chat message in specs. To do so, the preferred way is to use `Fabricate(:chat_message)` with a new `:use_service` option allowing to call the service under the hood. While this patch will obviously call `Chat::MessageCreator`, the new service patch will now be able to simply change the call to `Chat::CreateMessage` without breaking any specs from other plugins. Another thing this patch does is to not create chat messages using the service for specs that aren’t system ones, thus speeding the execution time a bit in the process. |
||
---|---|---|
.. | ||
chat_fabricator.rb |