diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/graphql/mutations/user_preferences/update.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/graphql/mutations/user_preferences/update.rb')
-rw-r--r-- | app/graphql/mutations/user_preferences/update.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/graphql/mutations/user_preferences/update.rb b/app/graphql/mutations/user_preferences/update.rb index c92c6d725b7..eface536a87 100644 --- a/app/graphql/mutations/user_preferences/update.rb +++ b/app/graphql/mutations/user_preferences/update.rb @@ -14,6 +14,15 @@ module Mutations null: true, description: 'User preferences after mutation.' + def ready?(**args) + if disabled_sort_value?(args) + raise Gitlab::Graphql::Errors::ArgumentError, + 'Feature flag `incident_escalations` must be enabled to use this sort order.' + end + + super + end + def resolve(**attributes) user_preferences = current_user.user_preference user_preferences.update(attributes) @@ -23,6 +32,14 @@ module Mutations errors: errors_on_object(user_preferences) } end + + private + + def disabled_sort_value?(args) + return false unless [:escalation_status_asc, :escalation_status_desc].include?(args[:issues_sort]) + + Feature.disabled?(:incident_escalations, default_enabled: :yaml) + end end end end |