Move edit account action to show

This commit is contained in:
Anton Khorev 2025-02-17 02:35:09 +03:00
parent 9929c1b585
commit d1de8462d6
25 changed files with 75 additions and 71 deletions

View file

@ -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

View file

@ -22,7 +22,7 @@ module Accounts
end
end
redirect_to edit_account_path
redirect_to account_path
end
end
end

View file

@ -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

View file

@ -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

View file

@ -91,7 +91,7 @@ class ConfirmationsController < ApplicationController
flash[:error] = t ".unknown_token"
end
redirect_to edit_account_path
redirect_to account_path
end
end

View file

@ -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

View file

@ -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)

View file

@ -40,4 +40,4 @@
<button class="btn btn-secondary" disabled><%= t(".delete_account") %></button>
<% end %>
<%= link_to t(".cancel"), edit_account_path, :class => "btn btn-link" %>
<%= link_to t(".cancel"), account_path, :class => "btn btn-link" %>

View file

@ -37,7 +37,7 @@
</label>
<%= hidden_field_tag("referer", params[:referer], :autocomplete => "off") %>
<%= text_field_tag("openid_url", "https://", :tabindex => 20, :autocomplete => "on", :class => "form-control") %>
<span class="form-text text-body-secondary">(<a href="<%= t "accounts.edit.openid.link" %>" target="_new"><%= t "accounts.edit.openid.link text" %></a>)</span>
<span class="form-text text-body-secondary">(<a href="<%= t "accounts.show.openid.link" %>" target="_new"><%= t "accounts.show.openid.link text" %></a>)</span>
</div>
<%= submit_tag t(".openid_login_button"), :tabindex => 21, :class => "btn btn-primary" %>

View file

@ -3,7 +3,7 @@
<% content_for :heading do %>
<ul class="nav nav-tabs flex-column flex-sm-row">
<li class="nav-item">
<%= link_to t(".account_settings"), edit_account_path, :class => "nav-link #{'active' if %w[accounts deletions].include?(controller_name)}" %>
<%= link_to t(".account_settings"), account_path, :class => "nav-link #{'active' if %w[accounts deletions].include?(controller_name)}" %>
</li>
<li class="nav-item">
<%= link_to t(".oauth2_applications"), oauth_applications_path, :class => "nav-link #{'active' if controller_name == 'oauth2_applications'}" %>

View file

@ -85,7 +85,7 @@
<span class='badge count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
<% end %>
<%= link_to t("users.show.my profile"), current_user, :class => "dropdown-item" %>
<%= link_to t("users.show.my_account"), edit_account_path, :class => "dropdown-item" %>
<%= link_to t("users.show.my_account"), account_path, :class => "dropdown-item" %>
<%= link_to t("users.show.my_preferences"), preferences_path, :class => "dropdown-item" %>
<div class="dropdown-divider"></div>
<% if current_user.home_location? %>

View file

@ -1,3 +1,3 @@
<p><%= t ".not_public" %></p>
<p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), edit_account_path(:anchor => "public")) %></p>
<p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), account_path(:anchor => "public")) %></p>
<p><%= t ".anon_edits_html", :link => link_to(t(".anon_edits_link_text"), t(".anon_edits_link")) %></p>

View file

@ -30,7 +30,7 @@
<span class='badge count-number'><%= number_with_delimiter(current_user.diary_comments.size) %></span>
</li>
<li>
<%= link_to t(".my_account"), edit_account_path %>
<%= link_to t(".my_account"), account_path %>
</li>
<% if current_user.blocks.exists? %>