Skip to content

Commit bb22427

Browse files
committed
fix(auth): don't extend a pico+ sub by a year if it is expired
1 parent 68e1ece commit bb22427

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/db/postgres/storage.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,9 @@ func (me *PsqlDB) RemoveFeature(userID string, name string) error {
17561756

17571757
func (me *PsqlDB) createFeatureExpiresAt(userID, name string) time.Time {
17581758
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() {
17601762
t := time.Now()
17611763
return t.AddDate(1, 0, 0)
17621764
}

0 commit comments

Comments
 (0)