Class: SimpleTeams::InvitationNotification

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

Instance Method Summary collapse

Instance Method Details

#invitationObject



32
33
34
# File 'app/notifications/simple_teams/invitation_notification.rb', line 32

def invitation
  team.invitations.find_by(id: params[:invitation_id]) if team.present?
end

#invitation_nameObject



41
42
43
# File 'app/notifications/simple_teams/invitation_notification.rb', line 41

def invitation_name
  invitation.present? ? invitation.email : params[:invitation_name]
end


19
20
21
# File 'app/notifications/simple_teams/invitation_notification.rb', line 19

def link_text
  "View Invitations"
end

#messageObject

Raises:

  • (NotImplemented)


5
6
7
# File 'app/notifications/simple_teams/invitation_notification.rb', line 5

def message
  raise NotImplemented
end

#subjectObject

Raises:

  • (NotImplemented)


9
10
11
# File 'app/notifications/simple_teams/invitation_notification.rb', line 9

def subject
  raise NotImplemented
end

#teamObject

Objects



24
25
26
# File 'app/notifications/simple_teams/invitation_notification.rb', line 24

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

#team_nameObject

Names (fallback)



37
38
39
# File 'app/notifications/simple_teams/invitation_notification.rb', line 37

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

#urlObject



13
14
15
16
17
# File 'app/notifications/simple_teams/invitation_notification.rb', line 13

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

#userObject



28
29
30
# File 'app/notifications/simple_teams/invitation_notification.rb', line 28

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

#user_nameObject



45
46
47
48
49
50
51
# File 'app/notifications/simple_teams/invitation_notification.rb', line 45

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