Class: NotificationEmailer::EmailUser

Inherits:
Object
  • Object
show all
Defined in:
app/services/notification_emailer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notification, no_delay: false) ⇒ EmailUser

Returns a new instance of EmailUser.



7
8
9
10
# File 'app/services/notification_emailer.rb', line 7

def initialize(notification, no_delay: false)
  @notification = notification
  @no_delay = no_delay
end

Instance Attribute Details

#no_delayObject (readonly)

Returns the value of attribute no_delay.



5
6
7
# File 'app/services/notification_emailer.rb', line 5

def no_delay
  @no_delay
end

#notificationObject (readonly)

Returns the value of attribute notification.



5
6
7
# File 'app/services/notification_emailer.rb', line 5

def notification
  @notification
end

Class Method Details

.notification_params(notification, type) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'app/services/notification_emailer.rb', line 60

def self.notification_params(notification, type)
  post_id = (notification.data_hash[:original_post_id] || notification.post_id).to_i
  notification_type = Notification.types[notification.notification_type]

  hash = {
    type: type.to_s,
    user_id: notification.user_id,
    notification_id: notification.id,
    notification_data_hash: notification.data_hash,
    notification_type: notification_type.to_s,
  }

  hash[:post_id] = post_id if post_id > 0 && notification_type != :post_approved
  hash
end

Instance Method Details

#group_mentionedObject



12
13
14
# File 'app/services/notification_emailer.rb', line 12

def group_mentioned
  enqueue :group_mentioned
end

#invited_to_private_messageObject



52
53
54
# File 'app/services/notification_emailer.rb', line 52

def invited_to_private_message
  enqueue(:user_invited_to_private_message, private_delay)
end

#invited_to_topicObject



56
57
58
# File 'app/services/notification_emailer.rb', line 56

def invited_to_topic
  enqueue(:user_invited_to_topic, private_delay)
end

#linkedObject



36
37
38
# File 'app/services/notification_emailer.rb', line 36

def linked
  enqueue :user_linked
end

#mentionedObject



16
17
18
# File 'app/services/notification_emailer.rb', line 16

def mentioned
  enqueue :user_mentioned
end

#post_approvedObject



44
45
46
# File 'app/services/notification_emailer.rb', line 44

def post_approved
  enqueue :post_approved
end

#postedObject



20
21
22
# File 'app/services/notification_emailer.rb', line 20

def posted
  enqueue :user_posted
end

#private_messageObject



48
49
50
# File 'app/services/notification_emailer.rb', line 48

def private_message
  enqueue_private(:user_private_message)
end

#quotedObject



28
29
30
# File 'app/services/notification_emailer.rb', line 28

def quoted
  enqueue :user_quoted
end

#repliedObject



32
33
34
# File 'app/services/notification_emailer.rb', line 32

def replied
  enqueue :user_replied
end

#watching_category_or_tagObject



24
25
26
# File 'app/services/notification_emailer.rb', line 24

def watching_category_or_tag
  enqueue :user_posted
end

#watching_first_postObject



40
41
42
# File 'app/services/notification_emailer.rb', line 40

def watching_first_post
  enqueue :user_watching_first_post
end