diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 12:06:26 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 12:06:26 +0000 |
commit | deed6022efe0149d88c57ef1df736c83465643f9 (patch) | |
tree | 4cf4c7c1ce765e83547129607b6bd3881c0fad6b /app | |
parent | f7a13c56bf0ed7ff9591bf4cbf9e50487255c4bc (diff) | |
download | gitlab-ce-deed6022efe0149d88c57ef1df736c83465643f9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/users_controller.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c3c227b08c5..06374736dcf 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -16,7 +16,7 @@ class UsersController < ApplicationController skip_before_action :authenticate_user! prepend_before_action(only: [:show]) { authenticate_sessionless_user!(:rss) } - before_action :user, except: [:exists] + before_action :user, except: [:exists, :suggests] before_action :authorize_read_user_profile!, only: [:calendar, :calendar_activities, :groups, :projects, :contributed_projects, :starred_projects, :snippets] @@ -114,6 +114,14 @@ class UsersController < ApplicationController render json: { exists: !!Namespace.find_by_path_or_name(params[:username]) } end + def suggests + namespace_path = params[:username] + exists = !!Namespace.find_by_path_or_name(namespace_path) + suggestions = exists ? [Namespace.clean_path(namespace_path)] : [] + + render json: { exists: exists, suggests: suggestions } + end + private def user |