Skip to content

Commit c6d93ee

Browse files
committed
Don't give extra kb for switching between premiums
1 parent c9f394e commit c6d93ee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/controllers/subscriptions_controller.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,11 @@ def change
120120
new_billing_plan = BillingPlan.find_by(stripe_plan_id: new_plan_id, available: true)
121121
current_user.selected_billing_plan_id = new_billing_plan.id
122122

123-
# Add any bonus bandwidth our new plan grants
124-
current_user.upload_bandwidth_kb += new_billing_plan.bonus_bandwidth_kb
123+
# Add any bonus bandwidth our new plan grants, unless we're moving from Premium to Premium
124+
premium_ids = [3, 4, 5, 6]
125+
if !premium_ids.include?(current_user.selected_billing_plan_id) && premium_ids.include? new_plan_id
126+
current_user.upload_bandwidth_kb += new_billing_plan.bonus_bandwidth_kb
127+
end
125128

126129
current_user.save
127130

0 commit comments

Comments
 (0)