Self-review
This commit is contained in:
@@ -795,7 +795,7 @@ func (s *commonStore) Reservations(username string) ([]Reservation, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
reservations = append(reservations, Reservation{
|
reservations = append(reservations, Reservation{
|
||||||
Topic: unescapeUnderscore(topic),
|
Topic: fromSQLWildcard(topic),
|
||||||
Owner: NewPermission(ownerRead, ownerWrite),
|
Owner: NewPermission(ownerRead, ownerWrite),
|
||||||
Everyone: NewPermission(everyoneRead.Bool, everyoneWrite.Bool),
|
Everyone: NewPermission(everyoneRead.Bool, everyoneWrite.Bool),
|
||||||
})
|
})
|
||||||
@@ -895,6 +895,7 @@ func (s *commonStore) RemoveTier(code string) error {
|
|||||||
if !AllowedTier(code) {
|
if !AllowedTier(code) {
|
||||||
return ErrInvalidArgument
|
return ErrInvalidArgument
|
||||||
}
|
}
|
||||||
|
// This fails if any user has this tier
|
||||||
if _, err := s.db.Exec(s.queries.deleteTier, code); err != nil {
|
if _, err := s.db.Exec(s.queries.deleteTier, code); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -940,6 +941,7 @@ func (s *commonStore) TierByStripePrice(priceID string) (*Tier, error) {
|
|||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
return s.readTier(rows)
|
return s.readTier(rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *commonStore) readTier(rows *sql.Rows) (*Tier, error) {
|
func (s *commonStore) readTier(rows *sql.Rows) (*Tier, error) {
|
||||||
var id, code, name string
|
var id, code, name string
|
||||||
var stripeMonthlyPriceID, stripeYearlyPriceID sql.NullString
|
var stripeMonthlyPriceID, stripeYearlyPriceID sql.NullString
|
||||||
@@ -952,6 +954,7 @@ func (s *commonStore) readTier(rows *sql.Rows) (*Tier, error) {
|
|||||||
} else if err := rows.Err(); err != nil {
|
} else if err := rows.Err(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// When changed, note readUser() as well
|
||||||
return &Tier{
|
return &Tier{
|
||||||
ID: id,
|
ID: id,
|
||||||
Code: code,
|
Code: code,
|
||||||
@@ -965,8 +968,8 @@ func (s *commonStore) readTier(rows *sql.Rows) (*Tier, error) {
|
|||||||
AttachmentTotalSizeLimit: attachmentTotalSizeLimit.Int64,
|
AttachmentTotalSizeLimit: attachmentTotalSizeLimit.Int64,
|
||||||
AttachmentExpiryDuration: time.Duration(attachmentExpiryDuration.Int64) * time.Second,
|
AttachmentExpiryDuration: time.Duration(attachmentExpiryDuration.Int64) * time.Second,
|
||||||
AttachmentBandwidthLimit: attachmentBandwidthLimit.Int64,
|
AttachmentBandwidthLimit: attachmentBandwidthLimit.Int64,
|
||||||
StripeMonthlyPriceID: stripeMonthlyPriceID.String,
|
StripeMonthlyPriceID: stripeMonthlyPriceID.String, // May be empty
|
||||||
StripeYearlyPriceID: stripeYearlyPriceID.String,
|
StripeYearlyPriceID: stripeYearlyPriceID.String, // May be empty
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user