fix(broadcasting): broadcast on mark_helped! even when already false

- mark_helped! gated broadcast on if save, but save returns false
  when needs_help is already false (no dirty attributes in CouchDB)
- Same fix applied to remove_needs_payment!
- Broadcast is the important side effect — save is just persistence
This commit is contained in:
BenClaw
2026-05-17 19:48:19 +02:00
parent bdd1d248db
commit 4ad701c1a5
+7 -9
View File
@@ -236,23 +236,21 @@ class List
def mark_helped!
self.needs_help = false
if save
broadcast_users 'list_helped', id: id
broadcast_supplier supplier_id, 'list_helped', id: id
end
save
broadcast_users 'list_helped', id: id
broadcast_supplier supplier_id, 'list_helped', id: id
end
def remove_needs_payment!
self.needs_payment = false
if save
broadcast_users 'remove_list_needs_payment', id: id
broadcast_supplier supplier_id, 'remove_list_needs_payment', id: id
end
save
broadcast_users 'remove_list_needs_payment', id: id
broadcast_supplier supplier_id, 'remove_list_needs_payment', id: id
end
def needs_payment!
self.needs_payment = true
if save
save
broadcast_users 'list_needs_payment', id: id
broadcast_supplier supplier_id, 'list_needs_payment', id: id
end