summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-16 23:08:50 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-16 23:08:50 +0000
commit9eef14279f1774110e68107372ef8cc758383168 (patch)
tree5b25fe83c0760faf8a11c2bbcf1528fcaa83e2ea
parent9a575522d542fad0adbc2a17e60ce830f510a932 (diff)
parente0f61a59b4e9be1fc2f20320a0400793318b8a9f (diff)
downloadgitlab-ce-9eef14279f1774110e68107372ef8cc758383168.tar.gz
Merge branch 'oauth-dup' into 'master'
Fix duplicate authorized applications On the profile applications page, display one row per authorized app instead of one row per access token. See #1987. cc @sytse See merge request !1524
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/profiles_controller.rb1
-rw-r--r--app/views/admin/applications/index.html.haml2
-rw-r--r--app/views/profiles/applications.html.haml10
4 files changed, 8 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4d8fb3585e4..3aac6f903f4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -55,6 +55,7 @@ v 7.8.0 (unreleased)
- Allow users that signed up via OAuth to set their password in order to use Git over HTTP(S).
- Show users button to share their newly created public or internal projects on twitter
- Add quick help links to the GitLab pricing and feature comparison pages.
+ - Fix duplicate authorized applications in user profile and incorrect application client count in admin area.
v 7.7.2
- Update GitLab Shell to version 2.4.2 that fixes a bug when developers can push to protected branch
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index f7584c03411..a7863aba756 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -16,6 +16,7 @@ class ProfilesController < ApplicationController
def applications
@applications = current_user.oauth_applications
@authorized_tokens = current_user.oauth_authorized_tokens
+ @authorized_apps = @authorized_tokens.map(&:application).uniq
end
def update
diff --git a/app/views/admin/applications/index.html.haml b/app/views/admin/applications/index.html.haml
index f2fed51eaf8..d550278710e 100644
--- a/app/views/admin/applications/index.html.haml
+++ b/app/views/admin/applications/index.html.haml
@@ -17,6 +17,6 @@
%tr{:id => "application_#{application.id}"}
%td= link_to application.name, admin_application_path(application)
%td= application.redirect_uri
- %td= application.access_tokens.count
+ %td= application.access_tokens.map(&:resource_owner_id).uniq.count
%td= link_to 'Edit', edit_admin_application_path(application), class: 'btn btn-link'
%td= render 'delete_form', application: application
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