DEV: extract the logic for extracting and expanding mentions from ChatNotifier (#20290)

Initially, the ChatMention model / db table was introduced to better support notifications (see discourse/discourse-chat@0801d10). That means that currently, we create a new chat_mention record only if a user will be notified about the mention.

Now we plan to start using the ChatMention model in other scenarios (for example for implementing user status on mentions) so we need to always create a new record in the chat_mention table. This PR does the first step into that direction by decoupling the logic for extracting and expanding mentions from the code related to notifications.

This doesn't change any behavior, only extracts code from ChatNotifier.
This commit is contained in:
Andrei Prigorshnev
2023-02-16 19:55:18 +04:00
committed by GitHub
parent 7391f8e077
commit 75b81b6854
4 changed files with 270 additions and 80 deletions

View File

@ -178,6 +178,7 @@ after_initialize do
load File.expand_path("../lib/chat_message_updater.rb", __FILE__)
load File.expand_path("../lib/chat_message_rate_limiter.rb", __FILE__)
load File.expand_path("../lib/chat_message_reactor.rb", __FILE__)
load File.expand_path("../lib/chat_message_mentions.rb", __FILE__)
load File.expand_path("../lib/chat_notifier.rb", __FILE__)
load File.expand_path("../lib/chat_seeder.rb", __FILE__)
load File.expand_path("../lib/chat_statistics.rb", __FILE__)