Skip to content

DEV: Autoload and segregate features to prep for migration #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 21, 2025
Merged

Conversation

nattsw
Copy link
Contributor

@nattsw nattsw commented Mar 19, 2025

This PR autoloads plugin files, and also extracts features into their own modules.

  • plugin.rb is smaller
  • external plugins like discourse-automation and discourse-assign have their own entrypoints
  • solved filters as well

This is to prepare for the "custom fields" -> "table" move, which is done to allow the feature to show which user marked an answer as reply.

Ideally, we should have a subsequent PR that consolidates wherever custom fields are used since they are now sprinkled everywhere 😮‍💨 making the migration more tedious than it should.

Comment on lines -35 to -48
require_relative "app/controllers/answer_controller"
require_relative "app/lib/first_accepted_post_solution_validator"
require_relative "app/lib/accepted_answer_cache"
require_relative "app/lib/guardian_extensions"
require_relative "app/lib/before_head_close"
require_relative "app/lib/category_extension"
require_relative "app/lib/post_serializer_extension"
require_relative "app/lib/topic_posters_summary_extension"
require_relative "app/lib/topic_view_serializer_extension"
require_relative "app/lib/user_summary_extension"
require_relative "app/lib/web_hook_extension"
require_relative "app/serializers/concerns/topic_answer_mixin"

require_relative "app/lib/plugin_initializers/assigned_reminder_exclude_solved"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more

Comment on lines +418 to +420
DiscourseDev::DiscourseSolved.populate(self)
DiscourseAutomation::EntryPoint.inject(self) if defined?(DiscourseAutomation)
DiscourseAssign::EntryPoint.inject(self) if defined?(DiscourseAssign)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes more

@nattsw nattsw merged commit e82c6ae into main Mar 21, 2025
4 checks passed
@nattsw nattsw deleted the autoload branch March 21, 2025 03:45
nattsw added a commit that referenced this pull request Mar 25, 2025
Related: 
- #309
- #341

Requires:
- discourse/discourse#31954

This commit converts all use of post and topic custom fields into a dedicated table:
- migration for copying custom field into table
- swap app usage of custom fields to table

This commit does not attempt to fix issues or optimise, and does not delete old data from custom fields _yet_.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants