Files
fizzy/app/models/bubble/eventable.rb
T
Kevin McConnell 782259a678 Events should track published now
Previously when an item was `created`, we'd track the event, update the
summary text, and broadcast the notifications. But now that we have a
draft state, we shold do all of this when it's published instead.
2025-01-15 10:58:00 +00:00

16 lines
463 B
Ruby

module Bubble::Eventable
extend ActiveSupport::Concern
private
def track_event(action, creator: Current.user, **particulars)
event = find_or_capture_event_summary.events.create! action: action, creator: creator, particulars: particulars
event.generate_notifications_later
end
def find_or_capture_event_summary
transaction do
messages.last&.event_summary || capture(EventSummary.new).event_summary
end
end
end