Fix meetings end date when it is multiyear#16393
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds year-awareness to meeting calendar rendering: new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.Change the |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
decidim-meetings/spec/cells/decidim/meetings/dates_and_map_cell_spec.rb (1)
76-90: Good multi-year coverage, but missing test for nilend_time.The multi-year test scenario is well-structured. However, unlike the
MeetingLCellspec which includes a "when meeting has no end time" context (lines 81-95 in that file), this spec lacks coverage for meetings without anend_time.Adding this test would help catch the nil guard issue flagged in the
DatesAndMapCellreview.📝 Suggested test addition
context "when meeting has no end time" do let!(:meeting) { create(:meeting, :published, start_time: Time.new(2020, 10, 15, 10, 0, 0, 0), end_time: nil) } it "shows the start time's month" do expect(subject).to have_css(".meeting__calendar-month", text: "October") end it "shows the start time's day" do expect(subject).to have_css(".meeting__calendar-day", text: "15") end it "does not show separator" do expect(subject).to have_no_css(".meeting__calendar-separator") end end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@decidim-meetings/spec/cells/decidim/meetings/dates_and_map_cell_spec.rb` around lines 76 - 90, The spec is missing coverage for a meeting with a nil end_time in decidim/meetings/dates_and_map_cell_spec.rb; add a new context "when meeting has no end time" that creates a published meeting with start_time set (e.g., Time.new(2020,10,15,10,0,0)) and end_time: nil, then assert via the cell subject that the start month's and day's elements (".meeting__calendar-month" and ".meeting__calendar-day") are present and that the separator element (".meeting__calendar-separator") is not present, mirroring the existing style used in the other contexts so the DatesAndMapCell rendering handles nil end_time safely.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@decidim-meetings/app/cells/decidim/meetings/dates_and_map_cell.rb`:
- Around line 24-26: The end_year method calls model.end_time without a
nil/blank guard which can raise when end_time is absent; update
decidim/meetings/dates_and_map_cell.rb's end_year to check for presence (e.g.
return nil or empty string unless model.end_time.present?) before calling l
model.end_time, format: "%Y", mirroring the guards used in MeetingLCell date
methods so the method is safe when end_time is missing.
- Around line 38-40: Add nil guards to the date comparison methods and end_year:
in same_year?, same_month?, and same_day? (methods in DatesAndMapCell) return
true immediately if end_time.blank? before calling .year/.month/.day to avoid
NoMethodError when end_time is nil; in end_year return an empty string (return
"" if end_time.blank?) before calling the localization helper. This mirrors
MeetingLCell's guards and prevents calling methods on nil.
---
Nitpick comments:
In `@decidim-meetings/spec/cells/decidim/meetings/dates_and_map_cell_spec.rb`:
- Around line 76-90: The spec is missing coverage for a meeting with a nil
end_time in decidim/meetings/dates_and_map_cell_spec.rb; add a new context "when
meeting has no end time" that creates a published meeting with start_time set
(e.g., Time.new(2020,10,15,10,0,0)) and end_time: nil, then assert via the cell
subject that the start month's and day's elements (".meeting__calendar-month"
and ".meeting__calendar-day") are present and that the separator element
(".meeting__calendar-separator") is not present, mirroring the existing style
used in the other contexts so the DatesAndMapCell rendering handles nil end_time
safely.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dd37ad3f-6e9c-475f-8698-bcb0b7151e0c
📒 Files selected for processing (8)
decidim-core/app/packs/stylesheets/decidim/_cards.scssdecidim-core/lib/decidim/assets/tailwind/tailwind.config.js.erbdecidim-meetings/app/cells/decidim/meetings/dates_and_map/show.erbdecidim-meetings/app/cells/decidim/meetings/dates_and_map_cell.rbdecidim-meetings/app/cells/decidim/meetings/meeting_l/image.erbdecidim-meetings/app/cells/decidim/meetings/meeting_l_cell.rbdecidim-meetings/spec/cells/decidim/meetings/dates_and_map_cell_spec.rbdecidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb
There was a problem hiding this comment.
🧹 Nitpick comments (1)
decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb (1)
108-110: Tighten the separator assertion to the year block.This currently passes if any calendar separator exists; scope it to
.card__calendar-yearto validate the multi-year behavior directly.Suggested diff
- it "shows the separator" do - expect(subject).to have_css(".card__calendar-separator") + it "shows the year separator" do + expect(subject).to have_css(".card__calendar-year .card__calendar-separator") end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb` around lines 108 - 110, The test "it shows the separator" currently checks for any calendar separator; narrow it to the year block by asserting the separator exists inside the `.card__calendar-year` element (e.g. expect(subject) to have CSS selector combining `.card__calendar-year` and `.card__calendar-separator`), so update the assertion in the example that defines the subject to look for `.card__calendar-year .card__calendar-separator` instead of just `.card__calendar-separator`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@decidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb`:
- Around line 108-110: The test "it shows the separator" currently checks for
any calendar separator; narrow it to the year block by asserting the separator
exists inside the `.card__calendar-year` element (e.g. expect(subject) to have
CSS selector combining `.card__calendar-year` and `.card__calendar-separator`),
so update the assertion in the example that defines the subject to look for
`.card__calendar-year .card__calendar-separator` instead of just
`.card__calendar-separator`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8ddba235-1535-405f-8b41-6d1402e2684b
📒 Files selected for processing (3)
decidim-meetings/app/cells/decidim/meetings/dates_and_map_cell.rbdecidim-meetings/spec/cells/decidim/meetings/dates_and_map_cell_spec.rbdecidim-meetings/spec/cells/decidim/meetings/meeting_l_cell_spec.rb
🚧 Files skipped from review as they are similar to previous changes (1)
- decidim-meetings/spec/cells/decidim/meetings/dates_and_map_cell_spec.rb
90f4acc
90f4acc to
5462d14
Compare
5462d14 to
8cf9405
Compare


🎩 What? Why?
This PR follows-up the last changes in Meetings calendar listing, doing 3 things:
text-xs) from 13px to 12px, as while checking this out with @decidim/product we noticed some inconsistencies with the Figma and Tailwind documentation. This should be 12px as far as we could see.📌 Related Issues
Testing
📷 Screenshots
Before
After
Summary by CodeRabbit
New Features
Style
Tests