Class: Gitlab::ImportExport::AvatarRestorer

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/import_export/avatar_restorer.rb

Instance Method Summary collapse

Constructor Details

#initialize(project:, shared:) ⇒ AvatarRestorer

Returns a new instance of AvatarRestorer.



6
7
8
9
# File 'lib/gitlab/import_export/avatar_restorer.rb', line 6

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

Instance Method Details

#restoreObject



11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/import_export/avatar_restorer.rb', line 11

def restore
  return true unless avatar_export_file

  @project.avatar = File.open(avatar_export_file)
  @project.save!
rescue StandardError => e
  @shared.error(e)
  false
end