Commit 49d50993 authored by Vinnie Okada's avatar Vinnie Okada

Avoid duplicate application rows

Iterate over authorized applications instead of tokens to avoid multiple
rows for the same authorized app.
parent ee804e2d
...@@ -16,6 +16,9 @@ class ProfilesController < ApplicationController ...@@ -16,6 +16,9 @@ class ProfilesController < ApplicationController
def applications def applications
@applications = current_user.oauth_applications @applications = current_user.oauth_applications
@authorized_tokens = current_user.oauth_authorized_tokens @authorized_tokens = current_user.oauth_authorized_tokens
@authorized_apps = @authorized_tokens.map do |token|
token.application
end.uniq
end end
def update def update
......
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
%th Scope %th Scope
%th %th
%tbody %tbody
- @authorized_tokens.each do |token| - @authorized_apps.each do |app|
- application = token.application - token = app.authorized_tokens.order('created_at desc').first
%tr{:id => "application_#{application.id}"} %tr{:id => "application_#{app.id}"}
%td= application.name %td= app.name
%td= token.created_at %td= token.created_at
%td= token.scopes %td= token.scopes
%td= render 'doorkeeper/authorized_applications/delete_form', application: application %td= render 'doorkeeper/authorized_applications/delete_form', application: app
- else - else
%p.light You dont have any authorized applications %p.light You dont have any authorized applications
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment