Class: SimpleTeams::BulkInvitationsNotification

Inherits:
ApplicationNotification show all
Defined in:
app/notifications/simple_teams/bulk_invitations_notification.rb

Instance Method Summary collapse

Instance Method Details

#invitation_namesObject



38
39
40
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 38

def invitation_names
  params[:invitation_names]
end


20
21
22
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 20

def link_text
  "View Invitations"
end

#messageObject



6
7
8
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 6

def message
  "#{user_name} invited #{invitation_names.to_sentence} to #{team_name}."
end

#subjectObject



10
11
12
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 10

def subject
  "Users Invited"
end

#teamObject

Objects



25
26
27
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 25

def team
  Team.find_by(id: params[:team_id])
end

#team_nameObject

Names (fallback)



34
35
36
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 34

def team_name
  team.present? ? team.name : params[:team_name]
end

#urlObject



14
15
16
17
18
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 14

def url
  if team.present? and team.members.include? recipient
    "/teams/#{team.id}"
  end
end

#userObject



29
30
31
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 29

def user
  SimpleTeams.member_class.find_by(id: params[:user_id])
end

#user_nameObject



42
43
44
45
46
47
48
# File 'app/notifications/simple_teams/bulk_invitations_notification.rb', line 42

def user_name
  if recipient.id == params[:user_id]
    "You"
  else
    user.present? ? user.full_name : params[:user_name]
  end
end