Class: SimpleTeams::MembershipNotification

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

Instance Method Summary collapse

Instance Method Details



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

def link_text
  "View Permissions"
end

#memberObject



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

def member
  team.members.find_by(id: params[:member_id]) if team.present?
end

#member_nameObject



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

def member_name
  if recipient.id == params[:member_id]
    "you"
  else
    member.present? ? member.full_name : params[:member_name]
  end
end

#messageObject

Raises:

  • (NotImplemented)


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

def message
  raise NotImplemented
end

#subjectObject

Raises:

  • (NotImplemented)


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

def subject
  raise NotImplemented
end

#teamObject

Objects



24
25
26
# File 'app/notifications/simple_teams/membership_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/membership_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/membership_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/membership_notification.rb', line 28

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

#user_nameObject



49
50
51
52
53
54
55
# File 'app/notifications/simple_teams/membership_notification.rb', line 49

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