-
Notifications
You must be signed in to change notification settings - Fork 805
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
Add has_required_plan to product info and implement it in Search #22682
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Add has_required_plan to product info and implement method in Search |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: changed | ||
|
||
Updated package dependencies. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
namespace Automattic\Jetpack\My_Jetpack\Products; | ||
|
||
use Automattic\Jetpack\My_Jetpack\Module_Product; | ||
use Automattic\Jetpack\Search\Plan as Search_Plan; | ||
|
||
/** | ||
* Class responsible for handling the Search product | ||
|
@@ -86,4 +87,17 @@ public static function get_pricing_for_ui() { | |
'promotion_percentage' => '50', | ||
); | ||
} | ||
|
||
/** | ||
* Checks whether the current plan of the site already supports the product | ||
* | ||
* Returns true if it supports. Return false if a purchase is still required. | ||
* | ||
* Free products will always return true. | ||
* | ||
* @return boolean | ||
*/ | ||
public static function has_required_plan() { | ||
return ( new Search_PLan() )->supports_search(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow, I wonder how it didnt throw any errors |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: changed | ||
|
||
updated lock file |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: changed | ||
Comment: Updated composer.lock. | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: compat | ||
|
||
update lock file |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: other | ||
Comment: Updated composer.lock. | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
something we've been talking about. I thought.
I though we could check whether the product requires a plan at top of this method:
It's ok to me, just wanted to put in code the way that we'll have to take to deal with the product activation flow.
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.
has_required_plan
will return true by default. If the product doesn't need a plan, it will return true.But I agree that could be useful to have another property that specifically says if the product is free or not