Class: CollavreSlack::SlackInboundMessageUpdateJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- ApplicationJob
- CollavreSlack::SlackInboundMessageUpdateJob
- Includes:
- ErrorLoggable
- Defined in:
- app/jobs/collavre_slack/slack_inbound_message_update_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(payload) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/jobs/collavre_slack/slack_inbound_message_update_job.rb', line 20 def perform(payload) # reraise so transient errors reach retry_on and permanent ones reach # discard_on; the concern still logs before re-raising. with_slack_error_handling("SlackInboundMessageUpdateJob", reraise: true) do data = payload.with_indifferent_access comment = Collavre::Comment.find_by(id: data[:comment_id]) return unless comment new_content = data[:content] return if new_content.blank? # Mark as coming from Slack to prevent loop comment.instance_variable_set(:@from_slack, true) comment.update!(content: new_content) Rails.logger.info("[CollavreSlack] Updated comment #{comment.id} from Slack edit") end end |