mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 06:53:45 +08:00
DEV:refactor user badges create to get grant opts from method (#29372)
* DEV:refactor user badges create to get grant opts from method * Replace method overwrite with plugin modifier * Add aditional params * change modifier name
This commit is contained in:
parent
81396467d0
commit
e6a6c8db07
|
@ -103,7 +103,14 @@ class UserBadgesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
user_badge = BadgeGranter.grant(badge, user, granted_by: current_user, post_id: post_id)
|
||||
grant_opts_from_params =
|
||||
DiscoursePluginRegistry.apply_modifier(
|
||||
:user_badges_badge_grant_opts,
|
||||
{ granted_by: current_user, post_id: post_id },
|
||||
{ param: params },
|
||||
)
|
||||
|
||||
user_badge = BadgeGranter.grant(badge, user, grant_opts_from_params)
|
||||
|
||||
render_serialized(user_badge, DetailedUserBadgeSerializer, root: "user_badge")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user