Welcome to mirror list, hosted at ThFree Co, Russian Federation.

avatar_saver.rb « import_export « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: db90886ad11efd1d5121a40c183e891bff70f480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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