Class: Decidim::Admin::UnreportUser
- Inherits:
-
Command
- Object
- Command
- Decidim::Admin::UnreportUser
- Defined in:
- app/commands/decidim/admin/unreport_user.rb
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(reportable, current_user) ⇒ UnreportUser
constructor
Public: Initializes the command.
Constructor Details
#initialize(reportable, current_user) ⇒ UnreportUser
Public: Initializes the command.
reportable - A Decidim::User - The user reported current_user - the user performing the action
10 11 12 13 |
# File 'app/commands/decidim/admin/unreport_user.rb', line 10 def initialize(reportable, current_user) @reportable = reportable @current_user = current_user end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid, together with the resource.
-
:invalid if the resource is not reported
Returns nothing.
21 22 23 24 25 26 |
# File 'app/commands/decidim/admin/unreport_user.rb', line 21 def call return broadcast(:invalid) unless @reportable.reported? unreport! broadcast(:ok, @reportable) end |