diff options
author | Robert Speicher <robert@gitlab.com> | 2016-03-15 14:33:14 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-03-15 14:33:14 +0000 |
commit | 90e91e28e40f2d5d5205e62f6e01e23af4da117f (patch) | |
tree | b745cd4a914d2bef8dd9559f6aa8b2d0b15c7414 /app/controllers | |
parent | ea7d062fa60e3e622288237fc66a815348bbcf36 (diff) | |
parent | 8f21e2ae408a4ebd0e115846b9a639e7ce09a126 (diff) | |
download | gitlab-ce-90e91e28e40f2d5d5205e62f6e01e23af4da117f.tar.gz |
Merge branch 'application-settings' into 'master'
Applications tab on profile settings
Closes #13855
See merge request !3031
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/oauth/applications_controller.rb | 24 | ||||
-rw-r--r-- | app/controllers/profiles_controller.rb | 7 |
2 files changed, 14 insertions, 17 deletions
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb index dc22101cd5e..d1e4ac10f6c 100644 --- a/app/controllers/oauth/applications_controller.rb +++ b/app/controllers/oauth/applications_controller.rb @@ -8,7 +8,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController layout 'profile' def index - head :forbidden and return + set_index_vars end def create @@ -20,18 +20,11 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) redirect_to oauth_application_url(@application) else - render :new + set_index_vars + render :index end end - def destroy - if @application.destroy - flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :destroy]) - end - - redirect_to applications_profile_url - end - private def verify_user_oauth_applications_enabled @@ -40,6 +33,17 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController redirect_to applications_profile_url end + def set_index_vars + @applications = current_user.oauth_applications + @authorized_tokens = current_user.oauth_authorized_tokens + @authorized_anonymous_tokens = @authorized_tokens.reject(&:application) + @authorized_apps = @authorized_tokens.map(&:application).uniq.reject(&:nil?) + + # Don't overwrite a value possibly set by `create` + @application ||= Doorkeeper::Application.new + end + + # Override Doorkeeper to scope to the current user def set_application @application = current_user.oauth_applications.find(params[:id]) end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index fa7a1148961..50b8f38eecb 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -8,13 +8,6 @@ class ProfilesController < Profiles::ApplicationController def show end - def applications - @applications = current_user.oauth_applications - @authorized_tokens = current_user.oauth_authorized_tokens - @authorized_anonymous_tokens = @authorized_tokens.reject(&:application) - @authorized_apps = @authorized_tokens.map(&:application).uniq - [nil] - end - def update user_params.except!(:email) if @user.ldap_user? |