mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-08 04:15:18 +08:00
This change centralises how user actions are defined. ### How It Works `ReviewableActionBuilder::build_user_actions_bundle` defines all of the user actions that a reviewable should need. `ReviewableActionBuilder` also now includes matching `perform_*` methods, to go with the actions defined in `build_user_actions_bundle`. There's also an overridable `target_user` method. It defaults to `target_created_by`, since that's the most common case, but it will allow different reviewable types to define a different user to target: for example, `ReviewableUser` would want to have it return `target`. ### Supporting Changes `Reviewable::build_actions` is temporarily overridden in `ReviewableActionBuilder`. Because we need `build_actions` to define both the old and new actions, I've chosen to split these into separate methods (`build_legacy_combined_actions` and `build_new_separated_actions`) that reviewables will temporarily need to define. This allows minimal code churn of the old logic, while we can build the new logic within its own method. `Reviewable::build_actions` will ultimately be moved to `ReviewableActionBuilder`. `Reviewable::create_result` has been copied to `ReviewableActionBuilder`, and expanded to include the flag-handling functionality of `ReviewablePost::successful_transition`. |
||
|---|---|---|
| .. | ||
| reports | ||
| anon_cache_invalidator.rb | ||
| cached_counting.rb | ||
| category_hashtag.rb | ||
| custom_field.rb | ||
| has_custom_fields.rb | ||
| has_deprecated_columns.rb | ||
| has_destroyed_web_hook.rb | ||
| has_sanitizable_fields.rb | ||
| has_search_data.rb | ||
| has_url.rb | ||
| limited_edit.rb | ||
| locale_matchable.rb | ||
| localizable.rb | ||
| positionable.rb | ||
| reviewable_action_builder.rb | ||
| roleable.rb | ||
| searchable.rb | ||
| second_factor_manager.rb | ||
| stats_cacheable.rb | ||
| topic_tracking_state_publishable.rb | ||
| trashable.rb | ||