DEV: Make problem check registration more explicit (#26413)

Previously the problem check registry simply looked at the subclasses of ProblemCheck. This was causing some confusion in environments where eager loading is not enabled, as the registry would appear empty as a result of the classes never being referenced (and thus never loaded.)

This PR changes the approach to a more explicit one. I followed other implementations (bookmarkable and hashtag autocomplete.) As a bonus, this now has a neat plugin entry point as well.
This commit is contained in:
Ted Johansson
2024-03-28 14:00:47 +08:00
committed by GitHub
parent e04b35a184
commit 0c875cb4d5
6 changed files with 95 additions and 19 deletions

View File

@ -317,6 +317,10 @@ class Plugin::Instance
Site.preloaded_category_custom_fields << field
end
def register_problem_check(klass)
DiscoursePluginRegistry.register_problem_check(klass, self)
end
def custom_avatar_column(column)
reloadable_patch do |plugin|
UserLookup.lookup_columns << column