11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/simple_teams/accept_invitations_controller.rb', line 11
def create
if params[:commit] == "Decline"
@invitation.declined!
redirect_to main_app.root_path, :notice => "You have declined the invitation to the '#{@team.name}' #{@team.teamable.class.model_name.human}."
else
if @service_object.valid?
@service_object.perform
SimpleTeams::Invitations::AcceptedNotification.with(
:team_id => @team.id,
:invitation_id => @invitation.id,
:user_id => current_user.id,
:team_name => @team.name,
:invitation_name => @invitation.email,
:user_name => current_user.full_name
).deliver_later(@team.members)
redirect_to main_app.url_for(@team.teamable), :notice => "You have accepted the invitation to the '#{@team.name}' #{@team.teamable.class.model_name.human}."
else
render :new
end
end
end
|