Skip to content

Commit

Permalink
Do not display dates for upcoming moderated meetings (decidim#12295)
Browse files Browse the repository at this point in the history
* Do not display dates for upcoming moderated meetings

* Apply review recommendations
  • Loading branch information
alecslupu authored Jan 30, 2024
1 parent 3d44d43 commit 42acd38
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
2 changes: 1 addition & 1 deletion decidim-meetings/lib/decidim/meetings/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Engine < ::Rails::Engine
# meeting for the given participatory space.
Decidim.view_hooks.register(:upcoming_meeting_for_card, priority: Decidim::ViewHooks::LOW_PRIORITY) do |view_context|
published_components = Decidim::Component.where(participatory_space: view_context.current_participatory_space).published
upcoming_meeting = Decidim::Meetings::Meeting.where(component: published_components).published.upcoming.order(:start_time, :end_time).first
upcoming_meeting = Decidim::Meetings::Meeting.where(component: published_components).not_hidden.except_withdrawn.published.upcoming.order(:start_time, :end_time).first

next unless upcoming_meeting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,65 @@
end
end
end

context "when the meeting is withdrawn" do
let!(:upcoming_meeting1) do
create(:meeting, :published, :withdrawn, :upcoming, start_time: start_time - 1.year, end_time: start_time + 1.hour, component: component)
end

it "hides upcoming moderated meetings" do
visit decidim_assemblies.assemblies_path

within "#assembly_#{assembly.id}" do
expect(page).to have_selector(".card__icondata")

within ".card__icondata" do
expect(page).to have_text("31 MAY 2100")
expect(page).to have_text("12:34")
expect(page).to have_text("13:34")
end
end
end
end

context "when the meeting is not published" do
let!(:upcoming_meeting1) do
create(:meeting, :upcoming, start_time: start_time - 1.year, end_time: start_time + 1.hour, component: component)
end

it "hides upcoming moderated meetings" do
visit decidim_assemblies.assemblies_path

within "#assembly_#{assembly.id}" do
expect(page).to have_selector(".card__icondata")

within ".card__icondata" do
expect(page).to have_text("31 MAY 2100")
expect(page).to have_text("12:34")
expect(page).to have_text("13:34")
end
end
end
end

context "when the meeting is moderated" do
let!(:upcoming_meeting1) do
create(:meeting, :published, :moderated, :upcoming, start_time: start_time - 1.year, end_time: start_time + 1.hour, component: component)
end

it "hides upcoming moderated meetings" do
visit decidim_assemblies.assemblies_path

within "#assembly_#{assembly.id}" do
expect(page).to have_selector(".card__icondata")

within ".card__icondata" do
expect(page).to have_text("31 MAY 2100")
expect(page).to have_text("12:34")
expect(page).to have_text("13:34")
end
end
end
end
end
end

0 comments on commit 42acd38

Please sign in to comment.