diff options
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 |