Skip to content

fix: prompt for category before secondhand options - #14288

Draft
seanwessmith wants to merge 1 commit into
openfoodfacts:mainfrom
seanwessmith:agent/hide-secondhand-without-category
Draft

fix: prompt for category before secondhand options#14288
seanwessmith wants to merge 1 commit into
openfoodfacts:mainfrom
seanwessmith:agent/hide-secondhand-without-category

Conversation

@seanwessmith

@seanwessmith seanwessmith commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What

  • show an Add a category action in the Secondhand card when a product has no categories
  • keep Donation and Used product options hidden until a category is available
  • cover missing, empty, and populated categories_tags paths with a regression test

Why

Donation and Used product links need a category to build a relevant search. The action explains why those options are unavailable and takes contributors directly to the Categories field.

Validation

  • make test-unit test=secondhand_knowledge_panels.t
  • make check_perltidy TO_CHECK='lib/ProductOpener/KnowledgePanels.pm tests/unit/secondhand_knowledge_panels.t'
  • make check_critic TO_CHECK='lib/ProductOpener/KnowledgePanels.pm tests/unit/secondhand_knowledge_panels.t'
  • make check_translations
  • git diff --check

Fixes #11110

@codecov-commenter

codecov-commenter commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.50%. Comparing base (aa9ec3a) to head (ac2ad2e).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14288      +/-   ##
==========================================
+ Coverage   50.28%   55.50%   +5.22%     
==========================================
  Files         103      104       +1     
  Lines       26414    26477      +63     
  Branches     6319     6330      +11     
==========================================
+ Hits        13282    14696    +1414     
+ Misses      11371     9854    -1517     
- Partials     1761     1927     +166     
Flag Coverage Δ
integration-test-group-1 13.08% <0.00%> (?)
integration-test-group-2 9.20% <0.00%> (?)
integration-test-group-3 9.37% <0.00%> (?)
integration-test-group-4 33.39% <0.00%> (?)
integration-test-group-5 28.75% <0.00%> (?)
integration-test-group-6 9.14% <0.00%> (?)
integration-test-group-7 9.62% <0.00%> (?)
integration-test-group-8 28.29% <0.00%> (?)
integration-test-group-9 26.62% <0.00%> (?)
unit-test-group-1 25.78% <0.00%> (+0.77%) ⬆️
unit-test-group-2 31.03% <0.00%> (-0.23%) ⬇️
unit-test-group-3 34.40% <0.00%> (+0.83%) ⬆️
unit-test-group-4 22.43% <100.00%> (+0.14%) ⬆️
unit-test-group-5 27.74% <0.00%> (-0.56%) ⬇️
unit-test-group-6 22.06% <0.00%> (+0.55%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@teolemon

Copy link
Copy Markdown
Member

@seanwessmith the extra mile would be to add a nudge to add a category to get 2nd hand options. Something like "Add a category to discover 2nd hand options", using the Knowledge Panel Actions syntax present in other panels.

@seanwessmith
seanwessmith force-pushed the agent/hide-secondhand-without-category branch from 0a65af0 to ac2ad2e Compare August 19, 2026 07:39
@github-actions github-actions Bot added Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🌐 Translations labels Aug 19, 2026
@seanwessmith seanwessmith changed the title fix: hide secondhand panel without a category fix: prompt for category before secondhand options Aug 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🧪 tests 🌐 Translations

Projects

Status: To discuss and validate
Status: In progress

Development

Successfully merging this pull request may close these issues.

We should not display the Donation / 2nd Hand options on empty category

3 participants