avatar_uploader.rb 555 Bytes
Newer Older
1 2
# frozen_string_literal: true

3
class AvatarUploader < GitlabUploader
4
  include UploaderHelper
5 6 7
  include RecordsUploads::Concern
  include ObjectStorage::Concern
  prepend ObjectStorage::Extension::RecordsUploads
8

9
  def exists?
10
    model.avatar.file && model.avatar.file.present?
11
  end
12 13 14 15 16 17 18 19

  def move_to_store
    false
  end

  def move_to_cache
    false
  end
20

21
  def absolute_path
James Lopez's avatar
James Lopez committed
22
    self.class.absolute_path(model.avatar.upload)
23 24
  end

25 26 27 28 29
  private

  def dynamic_segment
    File.join(model.class.to_s.underscore, mounted_as.to_s, model.id.to_s)
  end
30
end