Clear out expired customer share links

CustomerToken.purge_expired deletes share links that have expired or
whose issue was deleted. It runs whenever a new link is made, so they
don't pile up, and from rake redmine_qbo:purge_customer_tokens for a
manual or scheduled run. Expired links were only ignored before.

Also drops Issue's belongs_to :customer_token: issues have no such
column, so the association could only raise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-17 19:51:25 -05:00
1 parent 0d143e6eb1
commit 30c1f5181e
4 files changed
+63 -2

No files matched your search

+5
View File
@@ -21,4 +21,9 @@ namespace :redmine_qbo do
puts "Checked #{estimates.size} estimate(s), created #{total} relation(s)."
end
desc "Delete customer share links that have expired or whose issue was deleted (also done whenever a link is made)"
task purge_customer_tokens: :environment do
puts "Deleted #{CustomerToken.purge_expired} customer share link(s)."
end
end