diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6200335a..8c19dcde 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -9,7 +9,7 @@ def index # GET /users/1 or /users/1.json def show - @api_tokens = ApiToken.all + @api_tokens = current_user?(@user) ? @user.api_tokens : [] @assigned_tasks = @user.assigned_tasks.active.desc(5) end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 7022bd71..2f3d7f98 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,12 +2,12 @@
氏名
- <%= link_to @user.name, user_path(@user), class: "text-muted text-decoration-none" %> + <%= @user.name %>アカウント名
- <%= link_to @user.screen_name, user_path(@user), class: "text-muted text-decoration-none" %> + <%= @user.screen_name %>APIトークン
- <% @api_tokens.each do |api_token| %> - <% if api_token.user_id == current_user.id %> +<% if logged_in? && current_user?(@user) %> +APIトークン
+ <% @api_tokens.each do |api_token| %>APIトークン: <%= api_token.secret %>
トークン名: <%= api_token.description %>
有効期限: <%= api_token.expired_at %>