Class: Gitlab::ImportExport::AvatarSaver

Inherits:
Object
  • Object
show all
Includes:
DurationMeasuring
Defined in:
lib/gitlab/import_export/avatar_saver.rb

Instance Method Summary collapse

Constructor Details

#initialize(project:, shared:) ⇒ AvatarSaver

Returns a new instance of AvatarSaver.


8
9
10
11
# File 'lib/gitlab/import_export/avatar_saver.rb', line 8

def initialize(project:, shared:)
  @project = project
  @shared = shared
end

Instance Method Details

#saveObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gitlab/import_export/avatar_saver.rb', line 13

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