Skip to content

Commit

Permalink
Merge pull request #559 from codeforjapan/update-debates-close_debate…
Browse files Browse the repository at this point in the history
…_form

Update a form in v0.27.4
  • Loading branch information
ayuki-joto authored Sep 23, 2023
2 parents 558d407 + 5f8e223 commit 517df3c
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit 517df3c

Please sign in to comment.