Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 888623429a2..38fa247055e 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -1077,6 +1077,8 @@ module API
end
end
+ helpers Helpers::UserPreferencesHelpers
+
desc "Get the currently authenticated user's SSH keys" do
success Entities::SSHKey
end
@@ -1267,7 +1269,9 @@ module API
optional :view_diffs_file_by_file, type: Boolean, desc: 'Flag indicating the user sees only one file diff per page'
optional :show_whitespace_in_diffs, type: Boolean, desc: 'Flag indicating the user sees whitespace changes in diffs'
optional :pass_user_identities_to_ci_jwt, type: Boolean, desc: 'Flag indicating the user passes their external identities to a CI job as part of a JSON web token.'
- at_least_one_of :view_diffs_file_by_file, :show_whitespace_in_diffs, :pass_user_identities_to_ci_jwt
+ optional :code_suggestions, type: Boolean, desc: 'Flag indicating the user allows code suggestions.' \
+ 'Argument is experimental and can be removed in the future without notice.'
+ at_least_one_of :view_diffs_file_by_file, :show_whitespace_in_diffs, :pass_user_identities_to_ci_jwt, :code_suggestions
end
put "preferences", feature_category: :user_profile, urgency: :high do
authenticate!
@@ -1276,6 +1280,10 @@ module API
attrs = declared_params(include_missing: false)
+ attrs = update_user_namespace_settings(attrs)
+
+ render_api_error!('400 Bad Request', 400) unless attrs
+
service = ::UserPreferences::UpdateService.new(current_user, attrs).execute
if service.success?
present preferences, with: Entities::UserPreferences