Class: Decidim::Admin::UnpublishFeature

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/decidim/admin/unpublish_feature.rb

Overview

This command gets called when a feature is unpublished from the admin panel.

Instance Method Summary collapse

Constructor Details

#initialize(feature, current_user) ⇒ UnpublishFeature

Public: Initializes the command.

feature - The feature to unpublish. current_user - the user performing the action



11
12
13
14
# File 'app/commands/decidim/admin/unpublish_feature.rb', line 11

def initialize(feature, current_user)
  @feature = feature
  @current_user = current_user
end

Instance Method Details

#callObject

Public: Unpublishes the Feature.

Broadcasts :ok if unpublished, :invalid otherwise.



19
20
21
22
23
# File 'app/commands/decidim/admin/unpublish_feature.rb', line 19

def call
  unpublish_feature

  broadcast(:ok)
end