Skip to main content

max / makenotwork

server: badge library purchases Free by amount paid, not current price get_user_purchases computes is_free from (p.amount_cents = 0) instead of the item's current (i.price_cents = 0), so a later re-price to $0 can't retroactively flip a paid purchase's Free badge.
Co-Authored-By
Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-05 15:49 UTC
Signed with PGP, not checked
Commit: 34fb663535de9d262b74e5616ae098c1811ea2e2
Parent: c70d539
1 file changed, +5 insertions, -1 deletion
@@ -794,7 +794,11 @@
794 794 u.username as creator,
795 795 i.item_type,
796 796 p.purchased_at,
797 - (i.price_cents = 0) as is_free,
797 + -- Badge from what the buyer actually paid, not the item's current
798 + -- price: a later re-price to $0 must not retroactively badge a paid
799 + -- purchase "Free" (nor vice-versa). The purchases view carries the
800 + -- transaction's own amount_cents.
801 + (p.amount_cents = 0) as is_free,
798 802 lk.key_code as license_key_code,
799 803 (vc.total_versions > 0 AND vc.total_versions > COALESCE(dc.downloaded_count, 0)) as has_new_version
800 804 FROM purchases p