Class: Collavre::InboxReplyService

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

Overview

Handles inline replies from the inbox System topic. When a user sends a message in their inbox’s #System topic, this service finds the most recent notification (alarm) and cross-posts the reply to the original creative/topic that the notification was about.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comment) ⇒ InboxReplyService

Returns a new instance of InboxReplyService.



14
15
16
17
# File 'app/services/collavre/inbox_reply_service.rb', line 14

def initialize(comment)
  @comment = comment
  @creative = comment.creative
end

Class Method Details

.call(comment) ⇒ Object



10
11
12
# File 'app/services/collavre/inbox_reply_service.rb', line 10

def self.call(comment)
  new(comment).call
end

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
# File 'app/services/collavre/inbox_reply_service.rb', line 19

def call
  return unless eligible?

  original = find_original_comment
  return unless original

  cross_post(original)
end