Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/services/decidim/chatbot/workflows/proposals_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ def component
end

def proposals
@proposals ||= Decidim::Proposals::Proposal.where(component:).published.except_rejected.only_amendables
@proposals ||= Decidim::Proposals::Proposal
.where(component: component)
.published
.only_amendables
.left_joins(:proposal_state)
.where(
"decidim_proposals_proposal_states.token != 'rejected' " \
"OR decidim_proposals_proposal_states.token IS NULL"
)
end

def commentable_id
Expand Down
15 changes: 15 additions & 0 deletions spec/services/workflows/proposals_workflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ module Workflows
end
end

def proposals
@proposals ||= begin
base = Decidim::Proposals::Proposal
.where(decidim_component_id: component.id)
.published
.only_amendables

base.left_joins(:proposal_state)
.where(
"decidim_proposals_proposal_states.token != 'rejected' " \
"OR decidim_proposals_proposal_states.token IS NULL"
)
end
end

context "when there are exactly per_page proposals" do
let!(:proposals) do
create_list(:proposal, 10, :evaluating, component: proposals_component, published_at: Time.current)
Expand Down