Commit bb22427
Eric Bower
·
2025-12-04 22:36:54 -0500 EST
parent 68e1ece
fix(auth): don't extend a pico+ sub by a year if it is expired
1 files changed,
+3,
-1
+3,
-1
| ... | ... | @@ -1756,7 +1756,9 @@ func (me *PsqlDB) RemoveFeature(userID string, name string) error { | |
| 1756 | 1756 | ||
| 1757 | 1757 | func (me *PsqlDB) createFeatureExpiresAt(userID, name string) time.Time { | |
| 1758 | 1758 | ff, _ := me.FindFeature(userID, name) | |
| 1759 | - | if ff == nil { | |
| 1759 | + | // if the feature flag has already expired we don't want to add a year to it since that will | |
| 1760 | + | // not grant the user a full year | |
| 1761 | + | if ff == nil || !ff.IsValid() { | |
| 1760 | 1762 | t := time.Now() | |
| 1761 | 1763 | return t.AddDate(1, 0, 0) | |
| 1762 | 1764 | } |