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
This commit is contained in:
Dmitriy Zaporozhets 2015-02-16 23:08:50 +00:00
commit 9eef14279f
4 changed files with 8 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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