Class: CollavreSlack::SlackInboundMessageDeleteJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- ApplicationJob
- CollavreSlack::SlackInboundMessageDeleteJob
- Includes:
- ErrorLoggable
- Defined in:
- app/jobs/collavre_slack/slack_inbound_message_delete_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(payload) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/jobs/collavre_slack/slack_inbound_message_delete_job.rb', line 21 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("SlackInboundMessageDeleteJob", reraise: true) do data = payload.with_indifferent_access comment = Collavre::Comment.find_by(id: data[:comment_id]) if comment # Mark as coming from Slack to prevent loop comment.instance_variable_set(:@from_slack, true) comment.destroy! Rails.logger.info("[CollavreSlack] Deleted comment #{data[:comment_id]} from Slack deletion") end # Clean up the comment link record if data[:slack_comment_link_id].present? SlackCommentLink.find_by(id: data[:slack_comment_link_id])&.destroy end end end |