From 4ad701c1a5015cf305301f1ad02f6a61467110f6 Mon Sep 17 00:00:00 2001 From: BenClaw Date: Sun, 17 May 2026 19:48:19 +0200 Subject: [PATCH] fix(broadcasting): broadcast on mark_helped! even when already false MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- app/models/list.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/models/list.rb b/app/models/list.rb index 77777155..ca3dfc92 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -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