From: Anton Khorev Date: Sun, 16 Feb 2025 23:35:09 +0000 (+0300) Subject: Move edit account action to show X-Git-Tag: live~108^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/d1de8462d6a3b6828c63952e34079739e28823c4?ds=sidebyside;hp=--cc Move edit account action to show --- d1de8462d6a3b6828c63952e34079739e28823c4 diff --git a/app/abilities/ability.rb b/app/abilities/ability.rb index dd377a727..7f47b578c 100644 --- a/app/abilities/ability.rb +++ b/app/abilities/ability.rb @@ -36,7 +36,7 @@ class Ability can [:read, :create, :update, :destroy], :oauth2_application can [:read, :destroy], :oauth2_authorized_application can [:read, :create, :destroy], :oauth2_authorization - can [:update, :destroy], :account + can [:read, :update, :destroy], :account can :update, :account_terms can :create, :account_pd_declaration can :read, :dashboard diff --git a/app/controllers/accounts/pd_declarations_controller.rb b/app/controllers/accounts/pd_declarations_controller.rb index 2d2569d62..4a636a888 100644 --- a/app/controllers/accounts/pd_declarations_controller.rb +++ b/app/controllers/accounts/pd_declarations_controller.rb @@ -22,7 +22,7 @@ module Accounts end end - redirect_to edit_account_path + redirect_to account_path end end end diff --git a/app/controllers/accounts/terms_controller.rb b/app/controllers/accounts/terms_controller.rb index 03007a532..568abcdb9 100644 --- a/app/controllers/accounts/terms_controller.rb +++ b/app/controllers/accounts/terms_controller.rb @@ -21,7 +21,7 @@ module Accounts if current_user.terms_agreed? # Already agreed to terms, so just show settings - redirect_to edit_account_path + redirect_to account_path end end end @@ -43,7 +43,7 @@ module Accounts referer = safe_referer(params[:referer]) if params[:referer] - redirect_to referer || edit_account_path + redirect_to referer || account_path end end end diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index d02943640..e2a82c20e 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -12,10 +12,10 @@ class AccountsController < ApplicationController before_action :check_database_readable before_action :check_database_writable, :only => [:update] - allow_thirdparty_images :only => [:edit, :update] - allow_social_login :only => [:edit, :update] + allow_thirdparty_images :only => [:show, :update] + allow_social_login :only => [:show, :update] - def edit + def show if errors = session.delete(:user_errors) errors.each do |attribute, error| current_user.errors.add(attribute, error) @@ -32,9 +32,9 @@ class AccountsController < ApplicationController params[:user][:auth_uid] == current_user.auth_uid) update_user(current_user, user_params) if current_user.errors.empty? - redirect_to edit_account_path + redirect_to account_path else - render :edit + render :show end else session[:new_user_settings] = user_params.to_h diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index 72c1955e0..27f2c949e 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -91,7 +91,7 @@ class ConfirmationsController < ApplicationController flash[:error] = t ".unknown_token" end - redirect_to edit_account_path + redirect_to account_path end end diff --git a/app/controllers/user_mutes_controller.rb b/app/controllers/user_mutes_controller.rb index 2068ab6a3..dfd89083e 100644 --- a/app/controllers/user_mutes_controller.rb +++ b/app/controllers/user_mutes_controller.rb @@ -16,7 +16,7 @@ class UserMutesController < ApplicationController @muted_users = current_user.muted_users @title = t ".title" - redirect_to edit_account_path unless @muted_users.any? + redirect_to account_path unless @muted_users.any? end def create diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0df971bd4..7f6619eab 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -101,7 +101,7 @@ class UsersController < ApplicationController current_user.data_public = true current_user.save flash[:notice] = t ".flash success" - redirect_to edit_account_path + redirect_to account_path end ## @@ -135,7 +135,7 @@ class UsersController < ApplicationController session[:user_errors] = current_user.errors.as_json - redirect_to edit_account_path + redirect_to account_path else user = User.find_by(:auth_provider => provider, :auth_uid => uid) diff --git a/app/views/accounts/deletions/show.html.erb b/app/views/accounts/deletions/show.html.erb index 9b9b0f182..5a22aa67b 100644 --- a/app/views/accounts/deletions/show.html.erb +++ b/app/views/accounts/deletions/show.html.erb @@ -40,4 +40,4 @@ <% end %> -<%= link_to t(".cancel"), edit_account_path, :class => "btn btn-link" %> +<%= link_to t(".cancel"), account_path, :class => "btn btn-link" %> diff --git a/app/views/accounts/edit.html.erb b/app/views/accounts/show.html.erb similarity index 100% rename from app/views/accounts/edit.html.erb rename to app/views/accounts/show.html.erb diff --git a/app/views/application/_auth_providers.html.erb b/app/views/application/_auth_providers.html.erb index 3edc6edd2..221e70472 100644 --- a/app/views/application/_auth_providers.html.erb +++ b/app/views/application/_auth_providers.html.erb @@ -37,7 +37,7 @@ <%= hidden_field_tag("referer", params[:referer], :autocomplete => "off") %> <%= text_field_tag("openid_url", "https://", :tabindex => 20, :autocomplete => "on", :class => "form-control") %> - (" target="_new"><%= t "accounts.edit.openid.link text" %>) + (" target="_new"><%= t "accounts.show.openid.link text" %>) <%= submit_tag t(".openid_login_button"), :tabindex => 21, :class => "btn btn-primary" %> diff --git a/app/views/application/_settings_menu.html.erb b/app/views/application/_settings_menu.html.erb index 14f1c2927..a0d3c0ad4 100644 --- a/app/views/application/_settings_menu.html.erb +++ b/app/views/application/_settings_menu.html.erb @@ -3,7 +3,7 @@ <% content_for :heading do %>