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

Remove similar initiatives logic and PreviousForm class leftovers #12841

Merged
merged 2 commits into from
May 15, 2024
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 @@ -3,12 +3,15 @@
module Decidim
module Initiatives
# A form object used to collect the data for a new initiative.
class InitiativeForm < PreviousForm
class InitiativeForm < Form
include TranslatableAttributes
include AttachmentAttributes

mimic :initiative

attribute :title, String
attribute :description, String
attribute :type_id, Integer
attribute :area_id, Integer
attribute :decidim_user_group_id, Integer
attribute :signature_type, String
Expand All @@ -21,6 +24,9 @@ class InitiativeForm < PreviousForm
attachments_attribute :photos
attachments_attribute :documents

validates :title, :description, presence: true
validates :title, length: { maximum: 150 }
validates :type_id, presence: true
validates :signature_type, presence: true
validates :area, presence: true, if: ->(form) { form.area_id.present? }
validate :notify_missing_attachment_if_errored
Expand All @@ -39,6 +45,10 @@ def map_model(model)
self.description = translated_attribute(model.description)
end

def type
@type ||= type_id ? Decidim::InitiativesType.find(type_id) : context.initiative.type
end

def signature_type_updatable?
state == "created" || state.nil?
end
Expand Down
24 changes: 0 additions & 24 deletions decidim-initiatives/app/forms/decidim/initiatives/previous_form.rb

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions decidim-initiatives/lib/decidim/initiatives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ module Initiatives
true
end

# Public Setting that defines the similarity minimum value to consider two
# initiatives similar. Defaults to 0.25.
config_accessor :similarity_threshold do
0.25
end

# Public Setting that defines how many similar initiatives will be shown.
# Defaults to 5.
config_accessor :similarity_limit do
5
end

# Minimum number of committee members required to pass the initiative to
# technical validation phase. Only applies to initiatives created by
# individuals.
Expand Down
Loading