Files
sure/app/models/lunchflow_item/sync_complete_event.rb
soky srm 5eadfaad98 Lunchflow integration (#259)
* First pass lunch flow

* Fixes

- Fix apikey not being saved properly due to provider no reload support
- Fix proper messages if we try to link existing accounts.

* Fix better error handling

* Filter existing transactions and skip duplicates

* FIX messaging

* Branding :)

* Fix XSS and linter

* FIX provider concern

- also fix code duplication

* FIX md5 digest

* Updated determine_sync_start_date to be account-aware

* Review fixes

* Broaden error catch to not crash UI

* Fix buttons styling

* FIX process account error handling

* FIX account cap and url parsing

* Lunch Flow brand

* Found orphan i18n strings

* Remove per conversation with @sokie

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2025-10-30 14:07:16 +01:00

26 lines
665 B
Ruby

class LunchflowItem::SyncCompleteEvent
attr_reader :lunchflow_item
def initialize(lunchflow_item)
@lunchflow_item = lunchflow_item
end
def broadcast
# Update UI with latest account data
lunchflow_item.accounts.each do |account|
account.broadcast_sync_complete
end
# Update the Lunchflow item view
lunchflow_item.broadcast_replace_to(
lunchflow_item.family,
target: "lunchflow_item_#{lunchflow_item.id}",
partial: "lunchflow_items/lunchflow_item",
locals: { lunchflow_item: lunchflow_item }
)
# Let family handle sync notifications
lunchflow_item.family.broadcast_sync_complete
end
end