summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinnie Okada <vokada@mrvinn.com>2015-02-14 13:26:08 -0700
committerVinnie Okada <vokada@mrvinn.com>2015-02-14 19:46:39 -0700
commit49d509935284c2f07c8f5cb53a31d5787c6ef7ab (patch)
tree2fd7ac3471a0050684434db38ce45914b7249f72
parentee804e2d94018f633c6e400b443ef514b5d7a10f (diff)
downloadgitlab-ce-49d509935284c2f07c8f5cb53a31d5787c6ef7ab.tar.gz
Avoid duplicate application rows
Iterate over authorized applications instead of tokens to avoid multiple rows for the same authorized app.
-rw-r--r--app/controllers/profiles_controller.rb3
-rw-r--r--app/views/profiles/applications.html.haml10
2 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index f7584c03411..e3e36505f0b 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -16,6 +16,9 @@ class ProfilesController < ApplicationController
def applications
@applications = current_user.oauth_applications
@authorized_tokens = current_user.oauth_authorized_tokens
+ @authorized_apps = @authorized_tokens.map do |token|
+ token.application
+ end.uniq
end
def update
diff --git a/app/views/profiles/applications.html.haml b/app/views/profiles/applications.html.haml
index cb24e4a3dde..4b5817e10bf 100644
--- a/app/views/profiles/applications.html.haml
+++ b/app/views/profiles/applications.html.haml
@@ -36,12 +36,12 @@
%th Scope
%th
%tbody
- - @authorized_tokens.each do |token|
- - application = token.application
- %tr{:id => "application_#{application.id}"}
- %td= application.name
+ - @authorized_apps.each do |app|
+ - token = app.authorized_tokens.order('created_at desc').first
+ %tr{:id => "application_#{app.id}"}
+ %td= app.name
%td= token.created_at
%td= token.scopes
- %td= render 'doorkeeper/authorized_applications/delete_form', application: application
+ %td= render 'doorkeeper/authorized_applications/delete_form', application: app
- else
%p.light You dont have any authorized applications