Class: NotificationRecipients::Builder::NewNote
- Inherits:
-
Base
- Object
- Base
- NotificationRecipients::Builder::NewNote
show all
- Defined in:
- app/services/notification_recipients/builder/new_note.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#add_recipients, #filter!, #make_recipient, #notification_recipients, #recipients, #user_scope
Constructor Details
#initialize(note) ⇒ NewNote
Returns a new instance of NewNote.
8
9
10
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 8
def initialize(note)
@note = note
end
|
Instance Attribute Details
#note ⇒ Object
Returns the value of attribute note.
6
7
8
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 6
def note
@note
end
|
Instance Method Details
#acting_user ⇒ Object
56
57
58
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 56
def acting_user
note.author
end
|
#build! ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 36
def build!
add_participants(note.author)
add_mentions(note.author, target: note)
if note.for_project_noteable?
add_project_watchers
else
add_group_watchers
end
add_custom_notifications
add_subscribed_users
end
|
#custom_action ⇒ Object
52
53
54
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 52
def custom_action
:new_note
end
|
#group ⇒ Object
28
29
30
31
32
33
34
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 28
def group
if note.for_project_noteable?
project.group
else
target.try(:group)
end
end
|
#project ⇒ Object
NOTE: may be nil, in the case of a PersonalSnippet
(this is okay because NotificationRecipient is written to handle nil projects)
24
25
26
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 24
def project
note.project
end
|
#recipients_target ⇒ Object
16
17
18
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 16
def recipients_target
note
end
|
#target ⇒ Object
12
13
14
|
# File 'app/services/notification_recipients/builder/new_note.rb', line 12
def target
note.noteable
end
|