app/commands/decidim/proposals/create_proposal.rb in decidim-proposals-0.10.1 vs app/commands/decidim/proposals/create_proposal.rb in decidim-proposals-0.11.0.pre1

- old
+ new

@@ -50,11 +50,11 @@ body: form.body, category: form.category, scope: form.scope, author: @current_user, decidim_user_group_id: form.user_group_id, - feature: form.feature, + component: form.component, address: form.address, latitude: form.latitude, longitude: form.longitude ) end @@ -82,19 +82,19 @@ attachment.attached_to = proposal attachment.save! end def attachments_allowed? - form.current_feature.settings.attachments_allowed? + form.current_component.settings.attachments_allowed? end def process_attachments? attachments_allowed? && attachment_present? end def proposal_limit_reached? - proposal_limit = form.current_feature.settings.proposal_limit + proposal_limit = form.current_component.settings.proposal_limit return false if proposal_limit.zero? if user_group user_group_proposals.count >= proposal_limit @@ -102,22 +102,22 @@ current_user_proposals.count >= proposal_limit end end def user_group - @user_group ||= Decidim::UserGroup.where(organization: organization, id: form.user_group_id).first + @user_group ||= Decidim::UserGroup.find_by(organization: organization, id: form.user_group_id) end def organization @organization ||= @current_user.organization end def current_user_proposals - Proposal.where(author: @current_user, feature: form.current_feature) + Proposal.where(author: @current_user, component: form.current_component).except_withdrawn end def user_group_proposals - Proposal.where(user_group: @user_group, feature: form.current_feature) + Proposal.where(user_group: @user_group, component: form.current_component).except_withdrawn end end end end