notification_preferences_reset.rb 579 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Mutations
  3. class User::Current::NotificationPreferencesReset < BaseMutation
  4. description 'Reset user notification settings'
  5. field :user, Gql::Types::UserType, null: false, description: 'Updated user object'
  6. def self.authorize(_obj, ctx)
  7. ctx.current_user.permissions?('user_preferences.notifications+ticket.agent')
  8. end
  9. def resolve
  10. ::User.reset_notifications_preferences!(context.current_user)
  11. { user: context.current_user.reload }
  12. end
  13. end
  14. end