]> git.openstreetmap.org Git - rails.git/commitdiff
Show user id on profile pages to moderators and admins
authorAnton Khorev <tony29@yandex.ru>
Tue, 5 Sep 2023 10:35:08 +0000 (13:35 +0300)
committerAnton Khorev <tony29@yandex.ru>
Tue, 5 Sep 2023 10:35:08 +0000 (13:35 +0300)
app/views/users/show.html.erb
config/locales/en.yml
test/controllers/users_controller_test.rb

index 6335b06d9895371bb4479105f5447495528c3992..81fda926b7a081b333add6d07f6d3aaa87989668 100644 (file)
                 <% end -%>
               </dd>
             <% end -%>
+            <% if current_user&.moderator? || current_user&.administrator? %>
+              <dt class="list-inline-item m-0"><%= t ".uid" %></dt>
+              <dd class="list-inline-item"><%= link_to @user.id, api_user_path(:id => @user.id) %></dd>
+            <% end -%>
           </dl>
         </small>
       </div>
index 2fc8f8196a75a8607b98494e5b8ef1d268cf4e52..ec845dc7c412426cae4875c7ee7d56fe84f30619 100644 (file)
@@ -2697,6 +2697,7 @@ en:
       remove as friend: Unfriend
       add as friend: Add Friend
       mapper since: "Mapper since:"
+      uid: "User id:"
       ct status: "Contributor terms:"
       ct undecided: Undecided
       ct declined: Declined
index 9358a5948ce205cc1e38bc11dc659b0c5e1a6fb6..402129d326e19908ba57feaf74c5f18a48acf9db 100644 (file)
@@ -495,6 +495,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/blocks']", 0
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/blocks_by']", 0
       assert_select "a[href='/blocks/new/#{ERB::Util.u(user.display_name)}']", 0
+      assert_select "a[href='/api/0.6/user/#{ERB::Util.u(user.id)}']", 0
     end
 
     # Login as a moderator
@@ -512,6 +513,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/blocks']", 0
       assert_select "a[href='/user/#{ERB::Util.u(user.display_name)}/blocks_by']", 0
       assert_select "a[href='/blocks/new/#{ERB::Util.u(user.display_name)}']", 1
+      assert_select "a[href='/api/0.6/user/#{ERB::Util.u(user.id)}']", 1
     end
   end