repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
bb22427
parent
68e1ece
author
Eric Bower
date
2025-12-04 22:36:54 -0500 EST
fix(auth): don't extend a pico+ sub by a year if it is expired
1 files changed,  +3, -1
M pkg/db/postgres/storage.go
+3, -1
 1@@ -1756,7 +1756,9 @@ func (me *PsqlDB) RemoveFeature(userID string, name string) error {
 2 
 3 func (me *PsqlDB) createFeatureExpiresAt(userID, name string) time.Time {
 4 	ff, _ := me.FindFeature(userID, name)
 5-	if ff == nil {
 6+	// if the feature flag has already expired we don't want to add a year to it since that will
 7+	// not grant the user a full year
 8+	if ff == nil || !ff.IsValid() {
 9 		t := time.Now()
10 		return t.AddDate(1, 0, 0)
11 	}