diff --git a/.rubocop.yml b/.rubocop.yml index 13bc55c..928b486 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,94 +1,2 @@ inherit_gem: decidim-dev: rubocop-decidim.yml - -inherit_mode: - merge: - - Exclude - -AllCops: - Exclude: - - "decidim-initiatives/lib/gem_overrides/origami/date.rb" - -Naming/FileName: - Exclude: - - "decidim-dev/lib/decidim-dev.rb" - -Metrics/CyclomaticComplexity: - Exclude: - - "decidim-admin/app/queries/decidim/admin/newsletter_recipients.rb" - -Metrics/ParameterLists: - Exclude: - - "decidim-core/lib/decidim/filter_form_builder.rb" - -Metrics/PerceivedComplexity: - Exclude: - - "decidim-admin/app/queries/decidim/admin/newsletter_recipients.rb" - -RSpec/DescribeClass: - Exclude: - - decidim-core/spec/lib/global_engines_spec.rb - -RSpec/EmptyExampleGroup: - Exclude: - - decidim-core/spec/lib/participatory_space_manifest_spec.rb - -RSpec/MultipleMemoizedHelpers: - Exclude: - - decidim-assemblies/spec/forms/assembly_form_spec.rb - -Rails/Output: - Exclude: - - lib/decidim/git_backport_manager.rb - - lib/decidim/github_manager/poster.rb - - decidim-core/lib/decidim/core.rb - - decidim-core/lib/decidim/component_manifest.rb - - decidim-core/lib/decidim/participatory_space_manifest.rb - -Rails/Exit: - Exclude: - - lib/decidim/git_backport_manager.rb - -RSpec/NoExpectationExample: - Exclude: - - decidim-admin/spec/system/participatory_space_private_user_spec.rb - - decidim-comments/spec/services/decidim/comments/comment_creation_spec.rb - - decidim-conferences/spec/cells/decidim/conferences/conference_speaker_cell_spec.rb - - decidim-core/spec/cells/decidim/date_range_cell_spec.rb - - decidim-core/spec/commands/decidim/unsubscribe_settings_spec.rb - - decidim-core/spec/controllers/registrations_controller_spec.rb - - decidim-core/spec/lib/importers/import_manifest_spec.rb - - decidim-core/spec/lib/map/geocoding_spec.rb - - decidim-core/spec/lib/participatory_space_manifest_spec.rb - - decidim-core/spec/services/decidim/events_manager_spec.rb - - decidim-core/spec/services/decidim/settings_change_spec.rb - - decidim-core/spec/services/decidim/zip_stream/zip_stream_writer_spec.rb - - decidim-core/spec/tasks/decidim_tasks_right_to_be_forgotten_spec.rb - - decidim-elections/spec/lib/tasks/decidim_election_generate_identification_keys_spec.rb - - decidim-elections/spec/lib/tasks/decidim_election_scheduled_tasks_spec.rb - - decidim-elections/spec/shared/vote_examples.rb - - decidim-elections/spec/system/key_ceremony_spec.rb - - decidim-elections/spec/system/vote_online_inside_a_voting_spec.rb - - decidim-initiatives/spec/system/admin/update_initiative_spec.rb - - decidim-initiatives/spec/system/initiative_signing_spec.rb - - decidim-meetings/spec/commands/admin/export_meeting_registrations_spec.rb - - decidim-meetings/spec/system/explore_meeting_directory_spec.rb - - decidim-meetings/spec/system/explore_meetings_spec.rb - - decidim-proposals/spec/lib/decidim/proposals/markdown_to_proposals_spec.rb - - decidim-proposals/spec/shared/import_proposals_examples.rb - - decidim-proposals/spec/shared/proposals_wizards_examples.rb - - decidim-proposals/spec/system/admin/admin_manages_participatory_texts_spec.rb - - decidim-proposals/spec/system/participatory_texts_spec.rb - - decidim-participatory_processes/spec/system/participatory_processes_spec.rb - -# fix these rules later -Capybara/SpecificFinders: - Enabled: false - -RSpec/IndexedLet: - Enabled: false - -Rails/HelperInstanceVariable: - Enabled: false - -# EOF fix these rules later diff --git a/app/controllers/concerns/decidim/privacy/account_controller_extensions.rb b/app/controllers/concerns/decidim/privacy/account_controller_extensions.rb deleted file mode 100644 index 07a03a6..0000000 --- a/app/controllers/concerns/decidim/privacy/account_controller_extensions.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# The following changes are related to "Ask old password for changing email/password(PR #11737)" -# These changes should be removed once it has been backported to v.27 -module Decidim - module Privacy - module AccountControllerExtensions - extend ActiveSupport::Concern - included do - def show - enforce_permission_to(:show, :user, current_user: current_user) - @account = form(AccountForm).from_model(current_user) - @account.password = nil - end - - def update - enforce_permission_to(:update, :user, current_user: current_user) - @account = form(AccountForm).from_params(account_params) - UpdateAccount.call(current_user, @account) do - on(:ok) do |email_is_unconfirmed| - flash[:notice] = if email_is_unconfirmed - t("account.update.success_with_email_confirmation", scope: "decidim") - else - t("account.update.success", scope: "decidim") - end - - bypass_sign_in(current_user) - redirect_to account_path(locale: current_user.reload.locale) - end - - on(:invalid) do |password| - fetch_entered_password(password) - flash[:alert] = t("account.update.error", scope: "decidim") - render action: :show - end - end - end - - private - - def fetch_entered_password(password) - @account.password = password - end - end - end - end -end diff --git a/app/controllers/concerns/decidim/privacy/application_controller_extensions.rb b/app/controllers/concerns/decidim/privacy/application_controller_extensions.rb index 586f2e2..f77c8fd 100644 --- a/app/controllers/concerns/decidim/privacy/application_controller_extensions.rb +++ b/app/controllers/concerns/decidim/privacy/application_controller_extensions.rb @@ -13,12 +13,10 @@ module ApplicationControllerExtensions def privacy_modal_snippets return unless respond_to?(:snippets) - return if current_user && current_user.public? - snippets.add(:foot, helpers.javascript_pack_tag("decidim_account_publish_handler")) - return unless user_signed_in? - - snippets.add(:foot, helpers.cell("decidim/privacy/publish_account_modal", current_user)) + if current_user && !current_user.public? && user_signed_in? + snippets.add(:foot, helpers.cell("decidim/privacy/publish_account_modal", current_user)) + end end end end diff --git a/app/controllers/concerns/decidim/privacy/profiles_controller_extensions.rb b/app/controllers/concerns/decidim/privacy/profiles_controller_extensions.rb index 241edac..a340dd0 100644 --- a/app/controllers/concerns/decidim/privacy/profiles_controller_extensions.rb +++ b/app/controllers/concerns/decidim/privacy/profiles_controller_extensions.rb @@ -9,7 +9,6 @@ module ProfilesControllerExtensions before_action :add_nofollow_meta_tag def show - return redirect_to profile_timeline_path(nickname: params[:nickname]) if profile_holder == current_user return redirect_to profile_members_path if profile_holder.is_a?(Decidim::UserGroup) raise ActionController::RoutingError, "Not Found" if profile_holder.published_at.nil? diff --git a/app/views/decidim/account/_old_password_field.html.erb b/app/views/decidim/account/_old_password_field.html.erb deleted file mode 100644 index 41e5e4b..0000000 --- a/app/views/decidim/account/_old_password_field.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% -old_password_options = { - autocomplete: "current-password", - required: true -} -old_password_options[:help_text] = t("devise.passwords.edit.old_password_help") if local_assigns.has_key?(:show_help_text) && show_help_text -%> -
<%= t("decidim.account.email_change.title") %>
-<%= t("decidim.account.email_change.body1", unconfirmed_email: current_user.unconfirmed_email) %>
-- <%== t( - "decidim.account.email_change.body2", - resend_link: link_to(t("decidim.account.email_change.send_again"), resend_confirmation_instructions_account_path, role: :button, method: :post, remote: true), - cancel_link: link_to(t("decidim.account.email_change.cancel"), cancel_email_change_account_path, role: :button, method: :post, remote: true)) %> -
-<%= t(".available_locales_helper") %>
- - <% if @account.errors[:password].any? || @account.errors[:password_confirmation].any? || @account.errors[:old_password].any?%> + <% if @account.password.present? %> <%= render partial: "password_fields", locals: { form: f, user: current_user } %> - <%= render partial: "old_password_field", locals: { form: f, show_help_text: true, unhide: false } %> - <% else %> - <% if current_organization.sign_in_enabled? %> -- -
-<%= t(".receive_notifications_about") %>
-<%= t(".notifications_sending_frequency") %>
- <%= f.collection_radio_buttons :notifications_sending_frequency, frequencies_collection, :first, :last, { checked: @notifications_settings.notifications_sending_frequency || "daily" } %> - -<%= t(".newsletters") %>
- +<%= render layout: "layouts/decidim/shared/layout_user_profile" do %> + <% add_decidim_page_title(t("notifications_settings", scope: "layouts.decidim.user_profile")) %> + <% content_for(:subtitle) { t("notifications_settings", scope: "layouts.decidim.user_profile") } %> + <%= form_for(@notifications_settings, url: notifications_settings_path, method: :put) do |f| %> +<%= t(".administrators") %>
-