Skip to content

Wire ItemTagNotifier to AASM complete event#61

Merged
dadachi merged 1 commit into
mainfrom
wire-item-tag-aasm-trigger
May 10, 2026
Merged

Wire ItemTagNotifier to AASM complete event#61
dadachi merged 1 commit into
mainfrom
wire-item-tag-aasm-trigger

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented May 10, 2026

Summary

Closes the AASM-trigger half of issue #58 PR #2 scope.

ItemTag now fires ItemTagNotifier on the complete AASM event via after_commit. Recipients are all shopkeepers in the shop's account, excluding the completer (completed_by). idle! does not fire.

event :complete do
  transitions from: [:idled], to: :completed
  after_commit :notify_completed
end

def notify_completed
  recipients = shop.account.shopkeepers
  recipients = recipients.where.not(id: completed_by_id) if completed_by_id.present?
  return if recipients.empty?
  ItemTagNotifier.with(record: self).deliver(recipients)
end

Out of scope

Test plan

  • 4 new test cases in item_tag_test.rb:
    • complete! fires notifier; recipient is the non-completer shopkeeper
    • complete! fires to all shopkeepers when completed_by is unset
    • complete! is a no-op when account has only the completer
    • idle! does not fire the notifier
  • bin/rails test — 423 runs, 884 assertions, 0 failures
  • bin/rubocop — 243 files, 0 offenses
  • bin/brakeman — 0 warnings

🤖 Generated with Claude Code

On idled → completed transition, ItemTag#after_commit fires
ItemTagNotifier to all shopkeepers in the shop's account except
the completer (completed_by). idle! does not fire.

Closes the AASM-trigger half of issue #58 PR #2 scope. APNs/FCM
provider credentials still need provisioning (bin/rails
credentials:edit) before delivery is enabled in production.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit d33b0f0 into main May 10, 2026
3 checks passed
@dadachi dadachi deleted the wire-item-tag-aasm-trigger branch May 10, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant