Files
fizzy/app/helpers/webhooks_helper.rb
T
2025-10-29 11:00:41 -05:00

30 lines
1.0 KiB
Ruby

module WebhooksHelper
ACTION_LABELS = {
card_assigned: "Card assigned",
card_closed: "Card moved to Done",
card_postponed: "Card moved to “Not Now”",
card_auto_postponed: "Card auto-closed as “Not Now”",
card_collection_changed: "Card collection changed",
card_due_date_added: "Card due date added",
card_due_date_changed: "Card due date changed",
card_due_date_removed: "Card due date removed",
card_published: "Card published",
card_reopened: "Card reopened",
card_sent_back_to_triage: "Card move back to Maybe",
card_title_changed: "Card title changed",
card_triaged: "Card column changed",
card_unassigned: "Card unassigned",
comment_created: "Comment created"
}.with_indifferent_access.freeze
def webhook_action_options(actions = Webhook::PERMITTED_ACTIONS)
actions.each_with_object({}) do |action, hash|
hash[action.to_s] = webhook_action_label(action)
end
end
def webhook_action_label(action)
ACTION_LABELS[action] || action.to_s.humanize
end
end