-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Domain Management: add unlimited email forwarding #3156
Conversation
e6e01fb
to
b2eaa9c
Compare
@@ -0,0 +1,12 @@ | |||
function emailForwardingPlanLimit( product_id ) { | |||
let planLimit; | |||
if ( product_id === 1008 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, we try to avoid including a product ID or slug at a random place in the code like this, in favor of functions that do the number/string comparison for us. This makes it easier for us to change the product ID or slug, as we only need to modify the function that does the actual comparison.
Currently, we use isBusiness
for this, which lives in lib/products-values
. If you change this function so that it accepts a product (which, in this case, is the plan), you could use that function instead of this comparison (i.e. isBusiness( plan )
).
b2eaa9c
to
055a569
Compare
Appreciate the feedback @drewblaisdell! Updated the function |
import { isBusiness } from 'lib/products-values'; | ||
|
||
function emailForwardingPlanLimit( plan ) { | ||
let planLimit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify that to:
return ( isBusiness( plan ) ? 100 : 5 );
Code looks good 👍 This is exactly what we need :D |
- This PR sets the email forwarding limit to 100 for Business users. Premium users still set at 5.
055a569
to
789f3e3
Compare
Thanks @gziolo! Changed the |
I was able to add 7 email forwards. Tested and LGTM! Nice work, @jeremeylduvall :) |
…wards Domain Management: add unlimited email forwarding
The Business bundle allows for unlimited email forwards. Currently though, Business users are still limited to 5 email forwards in Calypso. This PR does a few different things:
client/lib/domains/email-forwarding/
.emailForwardingPlanLimit
that acceptsproduct_id
as a param and returns the allowed amount of email forwards.client/my-sites/upgrades/domain-management/email-forwarding/email-forwarding-add-new.jsx
, this current email forwarding list length is compared against the return value fromemailForwardingPlanLimit
so the limit is set to 5 for Premium users and 100 for Business users (Easy to bump up, but 100 seemed pretty high).emailForwardingPlanLimit
to set the correct number for the "out of" value. In order for this to work, I addedselectedSite
as a prop so I could reference it later on.To test:
Here's how this currently looks on a site with a Business bundle active and 6 email forwards setup:
With 6 email forwards setup, I removed the Business bundle and the limit is set back to 5:
Fix for #2387. h/t to @bikedorkjon for writing most of the code in the original bug report. @gziolo is the kind of setup you were thinking of?