Class: Decidim::Initiatives::ApproveMembershipRequest

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-initiatives/app/commands/decidim/initiatives/approve_membership_request.rb

Overview

A command with all the business logic that creates a new initiative.

Instance Method Summary collapse

Constructor Details

#initialize(membership_request) ⇒ ApproveMembershipRequest

Public: Initializes the command.

membership_request - A pending committee member


10
11
12
# File 'decidim-initiatives/app/commands/decidim/initiatives/approve_membership_request.rb', line 10

def initialize(membership_request)
  @membership_request = membership_request
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

Returns nothing.


19
20
21
22
23
24
# File 'decidim-initiatives/app/commands/decidim/initiatives/approve_membership_request.rb', line 19

def call
  @membership_request.accepted!
  notify_applicant

  broadcast(:ok, @membership_request)
end