SUP-51436 toggle field visibility#548
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/Products/urban/content/licence/BaseBuildLicence.py (1)
519-519: Avoid duplicating optionality configuration forrepresentativeContacts.At Line 519,
optional=Trueduplicates whatsetOptionalAttributes(schema, optional_fields)already applies (including widget condition), creating two sources of truth for the same behavior.Suggested cleanup
ReferenceField( name="representativeContacts", widget=ReferenceBrowserWidget( force_close_on_insert=1, allow_search=1, only_for_review_states="enabled", allow_browse=0, show_indexes=1, available_indexes={"Title": "Nom"}, startup_directory="urban", wild_card_search=True, show_results_without_query=True, restrict_browsing_to_startup_directory=False, label=_( "urban_label_representative_contacts", default="RepresentativeContact(s)", ), popup_name="contact_reference_popup", ), - optional=True, schemata="urban_description", multiValued=1, relationship="basebuildlicenceRepresentativeContacts",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Products/urban/content/licence/BaseBuildLicence.py` at line 519, The field definition for representativeContacts currently sets optional=True redundantly; remove the explicit optional=True from the representativeContacts declaration and rely on setOptionalAttributes(schema, optional_fields) to apply optionality (and the widget condition) so there is a single source of truth; leave representativeContacts name and type unchanged and ensure optional_fields includes "representativeContacts" so setOptionalAttributes handles it.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/CHANGES.rst`:
- Around line 13-16: Remove the direct entry from docs/CHANGES.rst (the "Add
option to show or hide the representativeContacts field [WBoudabous]
(SUP-51436)" line) and instead create a towncrier news fragment file named
SUP-51436.feature under the news/ directory containing the single line: "Add
option to show or hide the representativeContacts field [WBoudabous]". Ensure
the CHANGES.rst entry is deleted so towncrier can regenerate the changelog from
the new fragment.
---
Nitpick comments:
In `@src/Products/urban/content/licence/BaseBuildLicence.py`:
- Line 519: The field definition for representativeContacts currently sets
optional=True redundantly; remove the explicit optional=True from the
representativeContacts declaration and rely on setOptionalAttributes(schema,
optional_fields) to apply optionality (and the widget condition) so there is a
single source of truth; leave representativeContacts name and type unchanged and
ensure optional_fields includes "representativeContacts" so
setOptionalAttributes handles it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e46637c2-f5c7-4de4-b160-b531ca401156
📒 Files selected for processing (2)
docs/CHANGES.rstsrc/Products/urban/content/licence/BaseBuildLicence.py
| New features: | ||
|
|
||
| -Add option to show or hide the representativeContacts field | ||
| [WBoudabous] (SUP-51436) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n docs/CHANGES.rst | head -50Repository: IMIO/Products.urban
Length of output: 1223
🏁 Script executed:
head -20 docs/CHANGES.rstRepository: IMIO/Products.urban
Length of output: 515
🏁 Script executed:
find . -type d -name "news*" -o -type d -name "changelog*" 2>/dev/null | head -20Repository: IMIO/Products.urban
Length of output: 69
🏁 Script executed:
fd -type f -name "pyproject.toml" -o -name "setup.cfg" -o -name "towncrier.toml" | head -5Repository: IMIO/Products.urban
Length of output: 233
🏁 Script executed:
ls -la news/ | head -20Repository: IMIO/Products.urban
Length of output: 228
🏁 Script executed:
find . -name "pyproject.toml" -o -name "setup.cfg" -o -name "towncrier.toml" | xargs grep -l "towncrier" 2>/dev/nullRepository: IMIO/Products.urban
Length of output: 79
🏁 Script executed:
cat pyproject.toml | grep -A 20 "towncrier"Repository: IMIO/Products.urban
Length of output: 646
Entry should not be directly added to docs/CHANGES.rst; create a news fragment instead.
This project uses towncrier for changelog management. Per the instructions in the file, new entries should not be added directly to docs/CHANGES.rst. Instead, create a news fragment file in the news/ directory named something like SUP-51436.feature containing:
Add option to show or hide the representativeContacts field [WBoudabous]
Then towncrier will automatically regenerate the changelog during the next release process. Remove the entry from lines 13-16 of docs/CHANGES.rst.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/CHANGES.rst` around lines 13 - 16, Remove the direct entry from
docs/CHANGES.rst (the "Add option to show or hide the representativeContacts
field [WBoudabous] (SUP-51436)" line) and instead create a towncrier news
fragment file named SUP-51436.feature under the news/ directory containing the
single line: "Add option to show or hide the representativeContacts field
[WBoudabous]". Ensure the CHANGES.rst entry is deleted so towncrier can
regenerate the changelog from the new fragment.
This PR adds the ability to show or hide the "representativeContacts" field.
Summary by CodeRabbit
New Features
Updates