Class: Collavre::Comments::TopicCommand

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

Instance Method Summary collapse

Constructor Details

#initialize(comment:, user:, url_helpers: Collavre::Engine.routes.url_helpers) ⇒ TopicCommand

Returns a new instance of TopicCommand.



4
5
6
7
8
9
# File 'app/services/collavre/comments/topic_command.rb', line 4

def initialize(comment:, user:, url_helpers: Collavre::Engine.routes.url_helpers)
  @comment = comment
  @user = user
  @creative = comment.creative.effective_origin
  @url_helpers = url_helpers
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
# File 'app/services/collavre/comments/topic_command.rb', line 11

def call
  return unless topic_command?

  create_topic
rescue StandardError => e
  Rails.logger.error("Topic command failed: #{e.message}")
  e.message
end