gitlab-org--gitlab-foss/lib/gitlab/import_export/avatar_saver.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
611 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Gitlab
module ImportExport
class AvatarSaver
include DurationMeasuring
def initialize(project:, shared:)
@project = project
@shared = shared
end
def save
with_duration_measuring do
break true unless @project.avatar.exists?
Gitlab::ImportExport::UploadsManager.new(
project: @project,
shared: @shared,
relative_export_path: 'avatar'
).save
end
rescue StandardError => e
@shared.error(e)
false
end
end
end
end