active.rb 546 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class Account::Avatar::Active < BaseQuery
  4. description 'Fetch actively used avatar of the currently logged-in user'
  5. type Gql::Types::AvatarType, null: true
  6. def resolve(...)
  7. return if context.current_user.image.blank?
  8. Avatar.find_by(
  9. object_lookup_id: ObjectLookup.by_name('User'),
  10. o_id: context.current_user.id,
  11. store_hash: context.current_user.image,
  12. )
  13. end
  14. end
  15. end