]> git.openstreetmap.org Git - rails.git/commitdiff
Use user_account_path for links to settings page
authorAndy Allan <git@gravitystorm.co.uk>
Thu, 12 Aug 2021 16:09:07 +0000 (17:09 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Thu, 12 Aug 2021 16:09:07 +0000 (17:09 +0100)
Much easier to read than having to be explicit about controllers etc

app/controllers/confirmations_controller.rb
app/controllers/users_controller.rb
app/views/layouts/_header.html.erb
app/views/site/edit.html.erb
app/views/users/show.html.erb

index 7b1c52ca68876ad3a22f24f0ac9d22bb91489c8d..2a00a49b0446a01654a777df9c09a4ad06525c9e 100644 (file)
@@ -93,10 +93,10 @@ class ConfirmationsController < ApplicationController
         current_user.tokens.delete_all
         session[:user] = current_user.id
         session[:fingerprint] = current_user.fingerprint
-        redirect_to :controller => :users, :action => :account, :display_name => current_user.display_name
+        redirect_to user_account_path(current_user)
       elsif token
         flash[:error] = t "confirmations.confirm_email.failure"
-        redirect_to :controller => :users, :action => :account, :display_name => token.user.display_name
+        redirect_to user_account_path(token.user)
       else
         flash[:error] = t "confirmations.confirm_email.unknown_token"
       end
index 727d8ee3faed139adce3edc3b0922bb81b94be0e..e3d5173a785f8510207194e9c9b5c38a1b166e46 100644 (file)
@@ -28,7 +28,7 @@ class UsersController < ApplicationController
 
       if current_user&.terms_agreed?
         # Already agreed to terms, so just show settings
-        redirect_to :action => :account, :display_name => current_user.display_name
+        redirect_to user_account_path(current_user)
       elsif current_user.nil? && session[:new_user].nil?
         redirect_to login_path(:referer => request.fullpath)
       end
@@ -47,7 +47,7 @@ class UsersController < ApplicationController
         if params[:referer]
           redirect_to safe_referer(params[:referer])
         else
-          redirect_to :action => :account, :display_name => current_user.display_name
+          redirect_to user_account_path(current_user)
         end
       elsif params[:decline]
         redirect_to t("users.terms.declined")
@@ -67,7 +67,7 @@ class UsersController < ApplicationController
       if params[:referer]
         redirect_to safe_referer(params[:referer])
       else
-        redirect_to :action => :account, :display_name => current_user.display_name
+        redirect_to user_account_path(current_user)
       end
     else
       self.current_user = session.delete(:new_user)
@@ -147,7 +147,7 @@ class UsersController < ApplicationController
     current_user.data_public = true
     current_user.save
     flash[:notice] = t "users.go_public.flash success"
-    redirect_to :action => "account", :display_name => current_user.display_name
+    redirect_to user_account_path(current_user)
   end
 
   def new
@@ -297,7 +297,7 @@ class UsersController < ApplicationController
 
       session[:user_errors] = current_user.errors.as_json
 
-      redirect_to :action => "account", :display_name => current_user.display_name
+      redirect_to user_account_path(current_user)
     elsif session[:new_user]
       session[:new_user].auth_provider = provider
       session[:new_user].auth_uid = uid
index 6b6271c2b8e13a858ae357cedf3b833be0f49179..a20474b57a2ed9624bb40265635e414e93b08c43 100644 (file)
@@ -95,7 +95,7 @@
             <span class='count-number'><%= number_with_delimiter(current_user.new_messages.size) %></span>
           <% end %>
           <%= link_to t("users.show.my profile"), user_path(current_user), :class => "dropdown-item" %>
-          <%= link_to t("users.show.my settings"), { :controller => "users", :action => "account", :display_name => current_user.display_name }, { :class => "dropdown-item" } %>
+          <%= link_to t("users.show.my settings"), user_account_path(current_user), :class => "dropdown-item" %>
           <%= link_to t("users.show.my_preferences"), preferences_path, :class => "dropdown-item" %>
           <div class="dropdown-divider"></div>
           <%= yield :greeting %>
index d991adf398075c89cdc113d9ee621cedb72ab8ec..b31b099737f4cfbd8019fda6353dbd14457e7947 100644 (file)
@@ -5,7 +5,7 @@
     <p><%= t "layouts.osm_read_only" %></p>
   <% elsif !current_user.data_public? %>
     <p><%= t ".not_public" %></p>
-    <p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), :controller => "users", :action => "account", :display_name => current_user.display_name, :anchor => "public") %></p>
+    <p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), user_account_path(current_user, :anchor => "public")) %></p>
     <p><%= t ".anon_edits_html", :link => link_to(t(".anon_edits_link_text"), t(".anon_edits_link")) %></p>
   <% else %>
     <%= render :partial => preferred_editor %>
index 1dd84edeaf4a581dd8a433a7616bab57675d2ce9..61a775c516bc987ec23df18afec09c47fcf8a2f4 100644 (file)
@@ -25,7 +25,7 @@
             <%= link_to t(".my comments"), :controller => "diary_entries", :action => "comments", :display_name => current_user.display_name %>
           </li>
           <li>
-            <%= link_to t(".my settings"), :controller => "users", :action => "account", :display_name => current_user.display_name %>
+            <%= link_to t(".my settings"), user_account_path(current_user) %>
           </li>
 
           <% if current_user.blocks.exists? %>