Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert: "fix error message displaying when reaching proposition add limit" #634

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ def create
enforce_permission_to :create, :proposal
@step = Decidim::Proposals::ProposalsController::STEP1
@form = form(Decidim::Proposals::ProposalForm).from_params(proposal_creation_params)
if proposal_limit_reached?
@form.errors.add(:base, I18n.t("decidim.proposals.new.limit_reached"))
flash.now[:alert] = I18n.t("proposals.create.error", scope: "decidim")
render :new
return
end

@proposal = Decidim::Proposals::Proposal.new(@form.attributes.except(
:user_group_id,
Expand Down Expand Up @@ -192,17 +186,6 @@ def map_attachment_objects(attachments)
end
end
end

def proposal_limit_reached?(form = form_proposal_params)
proposal_limit = form.current_component.settings.proposal_limit
return false if proposal_limit.zero?

current_user_proposals(form).count >= proposal_limit
end

def current_user_proposals(form)
Decidim::Proposals::Proposal.from_author(current_user).where(component: form.current_component).except_withdrawn
end
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ ignore_missing:
- decidim.term_customizer.admin.actions.*
- decidim.term_customizer.admin.add_translations.index.*
- decidim.term_customizer.admin.models.translations.fields.*
- decidim.proposals.new.limit_reached
- decidim.proposals.create.error

# Consider these keys used:
ignore_unused:
Expand Down
12 changes: 0 additions & 12 deletions spec/controllers/decidim/proposals/proposals_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,6 @@ module Proposals
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
end

context "and proposals limit is reached" do
before do
allow(controller).to receive(:proposal_limit_reached?).and_return(true)
end

it "does not create a proposal and raises an error" do
post :create, params: params
expect(response).to have_http_status(:ok)
expect(flash[:alert]).not_to be_empty
end
end
end
end

Expand Down
Loading