Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"update": "subscriptions",
"updates": [
{
"q": { "is_active": { "$exists": true } },
"u": { "$unset": { "is_active": "" } },
"multi": true
}
],
"writeConcern": { "w": "majority" }
}
]
2 changes: 0 additions & 2 deletions api/db/mongodb/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func (s *SubscriptionRepositorySuite) seedSub(tier string, activeUntil, updatedA
Tier: tier,
ActiveUntil: activeUntil,
UpdatedAt: updatedAt,
IsActive: true,
Notified: notified,
NotifiedInactive: notifiedPD,
}
Expand Down Expand Up @@ -276,7 +275,6 @@ func (s *SubscriptionRepositorySuite) TestFindDuplicateTokenHashGroups() {
Tier: "IVPN Tier 2",
ActiveUntil: now.Add(30 * 24 * time.Hour),
UpdatedAt: now,
IsActive: true,
TokenHash: tokenHash,
DeletionScheduledAt: deletionScheduled,
}
Expand Down
4 changes: 1 addition & 3 deletions api/internal/migrations/subscription_uuid_subtype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func (s *MigrateSuite) seedDoc(ctx context.Context, subtype byte, tier string) u
{Key: "_id", Value: primitive.Binary{Subtype: subtype, Data: id[:]}},
{Key: "account_id", Value: primitive.NewObjectID()},
{Key: "active_until", Value: time.Now().Add(30 * 24 * time.Hour).UTC().Truncate(time.Millisecond)},
{Key: "is_active", Value: true},
{Key: "tier", Value: tier},
{Key: "token_hash", Value: "hash-" + tier},
{Key: "updated_at", Value: time.Now().UTC().Truncate(time.Millisecond)},
Expand Down Expand Up @@ -191,7 +190,6 @@ func (s *MigrateSuite) TestMigrateResumesAfterPartialInsert() {
base := bson.D{
{Key: "account_id", Value: accountID},
{Key: "active_until", Value: time.Now().Add(24 * time.Hour).UTC().Truncate(time.Millisecond)},
{Key: "is_active", Value: true},
{Key: "tier", Value: "Tier 2"},
}

Expand Down Expand Up @@ -274,7 +272,7 @@ func (s *MigrateSuite) snapshotByUUID(ctx context.Context, coll *mongo.Collectio

func (s *MigrateSuite) assertFieldsPreserved(before, after bson.Raw) {
s.T().Helper()
preservedKeys := []string{"account_id", "active_until", "is_active", "tier", "token_hash", "updated_at", "notified", "limits"}
preservedKeys := []string{"account_id", "active_until", "tier", "token_hash", "updated_at", "notified", "limits"}
for _, key := range preservedKeys {
beforeVal := before.Lookup(key)
afterVal := after.Lookup(key)
Expand Down
1 change: 0 additions & 1 deletion api/model/preauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "time"
type Preauth struct {
ID string `json:"id"`
TokenHash string `json:"token_hash"`
IsActive bool `json:"is_active"`
ActiveUntil time.Time `json:"active_until"`
Tier string `json:"tier"`
}
1 change: 0 additions & 1 deletion api/model/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type Subscription struct {
ID uuid.UUID `json:"-" bson:"_id"`
AccountID primitive.ObjectID `json:"-" bson:"account_id"`
ActiveUntil time.Time `json:"active_until" bson:"active_until"`
IsActive bool `json:"-" bson:"is_active"`
// Type is a legacy pre-0.1.8 enum ("Free"/"Managed") retained so old documents
// surface to clients (the beta-ending banner gates on Type == "Managed").
// Cleared to "" by the resync flow once the user re-syncs with IVPN.
Expand Down
1 change: 0 additions & 1 deletion api/service/account/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func (suite *AccountTestSuite) TestGetUnfinishedSignupOrPostAccount() {
preauth := model.Preauth{
ID: preauthID,
TokenHash: tokenHashStr,
IsActive: true,
ActiveUntil: activeUntil,
Tier: "pro",
}
Expand Down
2 changes: 0 additions & 2 deletions api/service/subscription/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ func (s *SubscriptionService) CreateSubscriptionFromPreauth(ctx context.Context,
ID: uuid.New(),
AccountID: accOID,
ActiveUntil: preauth.ActiveUntil,
IsActive: preauth.IsActive,
Tier: preauth.Tier,
TokenHash: preauth.TokenHash,
UpdatedAt: time.Now(),
Expand Down Expand Up @@ -195,7 +194,6 @@ func (s *SubscriptionService) UpdateSubscriptionFromPASession(ctx context.Contex
}

sub.ActiveUntil = preauth.ActiveUntil
sub.IsActive = preauth.IsActive
sub.Tier = preauth.Tier
sub.TokenHash = preauth.TokenHash
sub.UpdatedAt = time.Now()
Expand Down
2 changes: 0 additions & 2 deletions api/service/subscription/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func newPreauthServer(t *testing.T, token string) *httptest.Server {
preauth := model.Preauth{
ID: "preauth-id-1",
TokenHash: tokenHashStr,
IsActive: true,
ActiveUntil: time.Now().Add(24 * time.Hour).UTC(),
Tier: "IVPN Tier 2",
}
Expand Down Expand Up @@ -214,7 +213,6 @@ func TestUpdateSubscriptionFromPASession_ClearsLegacyType(t *testing.T) {
preauth := model.Preauth{
ID: preauthID,
TokenHash: tokenHashStr,
IsActive: true,
ActiveUntil: activeUntil,
Tier: "IVPN Tier 2",
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap/mock-preauth/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Endpoints:
POST /entry - Create preauth entry (called by test setup)
Body: {"id": "...", "token_hash": "...", "is_active": true, "active_until": "...", "tier": "..."}
Body: {"id": "...", "token_hash": "...", "active_until": "...", "tier": "..."}
Returns: 201

GET /<id> - Get preauth entry (called by API during registration)
Expand Down
1 change: 0 additions & 1 deletion tests/libs/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def create_temp_subscription(
json={
"id": preauth_id,
"token_hash": token_hash,
"is_active": True,
"active_until": active_until,
"tier": tier,
},
Expand Down
Loading