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

Update a form in v0.27.4 #559

Merged
merged 1 commit into from
Sep 23, 2023
Merged
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
6 changes: 4 additions & 2 deletions app/forms/decidim/debates/close_debate_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class CloseDebateForm < Decidim::Form
mimic :debate

attribute :conclusions, Decidim::Attributes::CleanString
attribute :debate, Debate

validates :debate, presence: true
validates :conclusions, presence: true, length: { minimum: 10, maximum: 10_000 }
Expand All @@ -19,7 +18,6 @@ def closed_at

def map_model(debate)
super
self.debate = debate

# Debates can be translated in different languages from the admin but
# the public form doesn't allow it. When a user closes a debate the
Expand All @@ -31,6 +29,10 @@ def map_model(debate)
end
end

def debate
@debate ||= Debate.find_by(id: id)
end

private

def user_can_close_debate
Expand Down