-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
feat: add /org/[orgid] facet in pro platform URL #10432
feat: add /org/[orgid] facet in pro platform URL #10432
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10432 +/- ##
==========================================
- Coverage 49.54% 49.31% -0.23%
==========================================
Files 67 76 +9
Lines 20650 21827 +1177
Branches 4980 5231 +251
==========================================
+ Hits 10231 10764 +533
- Misses 9131 9744 +613
- Partials 1288 1319 +31 ☔ View full report in Codecov by Sentry. |
|
lib/ProductOpener/Display.pm
Outdated
# Compute HTML to display the small front image, currently embedded in the HTML of web queries | ||
if (not $api) { | ||
$product_ref->{image_front_small_html} = display_image_thumb($product_ref, 'front'); | ||
|
||
# For web queries with personal search, we can compute some generated fields we need | ||
# For web queries with personal search, we can compute some generated fields we ne<ed |
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.
# For web queries with personal search, we can compute some generated fields we ne<ed | |
# For web queries with personal search, we can compute some generated fields we need |
Wow, that's a big refactor! It's a good idea to split in multiple functions. |
lib/ProductOpener/Routing.pm
Outdated
# /search search endpoint, parameters will be parsed by CGI.pm param() | ||
elsif ($components[0] eq "search") { | ||
$request_ref->{search} = 1; | ||
if (keys %routes == 0) { |
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.
We should probably call load_routes() once in LoadData.pm module instead
😅 yes. Basically, I needed to potentially have access to all other paths starting with /org/[orgid] while allowing the public platform to not have that prefix. So I had to brake the path, taking the part I needed (orgid) and with the remaining let the existing routing act normally. |
lib/ProductOpener/Display.pm
Outdated
@@ -180,9 +182,18 @@ use ProductOpener::Cache qw/$max_memcached_object_size $memd generate_cache_key/ | |||
use ProductOpener::Permissions qw/has_permission/; | |||
use ProductOpener::ProductsFeatures qw(feature_enabled); | |||
|
|||
use ProductOpener::Index qw/:all/; | |||
use ProductOpener::Display qw/:all/; |
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.
I'm not sure if we need those lines? Especially Display as we are in Display.pm
a lot of those modules are already imported above
lib/ProductOpener/Routing.pm
Outdated
param("code", $components[3]); | ||
$request_ref->{code} = $components[3]; | ||
} | ||
elsif ($api_action eq "tag") { # api/v3/[tag]/[type]/[tagid] |
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.
elsif ($api_action eq "tag") { # api/v3/[tag]/[type]/[tagid] | |
elsif ($api_action eq "tag") { # api/v3/tag/[type]/[tagid] |
lib/ProductOpener/Routing.pm
Outdated
# Renamed text : en/nova-groups-for-food-processing -> nova, ... | ||
my @redirect_text_route = (); | ||
if (defined $options{redirect_texts}) { | ||
# we use a custome regex to exactly match "en/nova-groups-for-food-processing" |
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.
# we use a custome regex to exactly match "en/nova-groups-for-food-processing" | |
# we use a custom regex to exactly match "en/nova-groups-for-food-processing" |
lib/ProductOpener/Routing.pm
Outdated
return 1; | ||
} | ||
|
||
sub handle_other_tag_types_in_route($request_ref, @components) { |
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.
Maybe this function could be renamed to facets_route()
@@ -110,6 +110,8 @@ sub load_routes() { | |||
['', \&index_route], | |||
['^(?<page>\d+)$', \&index_route, {regex => 1}], | |||
['org/[orgid]/', \&org_route], | |||
# Known tag type? Catch all if no route matched |
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.
Great
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.
Looks good to me, thank you for all the refactor work!
What
Add a visible facet of the current org in the URL for connected users on the pro platform.
Allows admins and pro moderators to easily access pages of multiple orgs and share user-friendly URLs:
Eventually, it might helps a new feature that will give producers access to several organizations (sub brands).
This feature is added on top of the existing routing and does not break old URLs.
Related issue(s) and discussion