Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
2c1e66d4
Commit
2c1e66d4
authored
Jul 10, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix avatar saver and spec
parent
874a4ff1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
lib/gitlab/import_export/avatar_saver.rb
lib/gitlab/import_export/avatar_saver.rb
+6
-5
spec/lib/gitlab/import_export/avatar_saver_spec.rb
spec/lib/gitlab/import_export/avatar_saver_spec.rb
+3
-0
No files found.
lib/gitlab/import_export/avatar_saver.rb
View file @
2c1e66d4
...
@@ -11,7 +11,12 @@ module Gitlab
...
@@ -11,7 +11,12 @@ module Gitlab
def
save
def
save
return
true
unless
@project
.
avatar
.
exists?
return
true
unless
@project
.
avatar
.
exists?
copy_files
(
avatar_path
,
avatar_export_path
)
Gitlab
::
ImportExport
::
UploadsManager
.
new
(
project:
@project
,
shared:
@shared
,
relative_export_path:
'avatar'
,
from:
avatar_path
).
copy
rescue
=>
e
rescue
=>
e
@shared
.
error
(
e
)
@shared
.
error
(
e
)
false
false
...
@@ -19,10 +24,6 @@ module Gitlab
...
@@ -19,10 +24,6 @@ module Gitlab
private
private
def
avatar_export_path
File
.
join
(
@shared
.
export_path
,
'avatar'
,
@project
.
avatar_identifier
)
end
def
avatar_path
def
avatar_path
@project
.
avatar
.
path
@project
.
avatar
.
path
end
end
...
...
spec/lib/gitlab/import_export/avatar_saver_spec.rb
View file @
2c1e66d4
...
@@ -9,6 +9,7 @@ describe Gitlab::ImportExport::AvatarSaver do
...
@@ -9,6 +9,7 @@ describe Gitlab::ImportExport::AvatarSaver do
before
do
before
do
FileUtils
.
mkdir_p
(
"
#{
shared
.
export_path
}
/avatar/"
)
FileUtils
.
mkdir_p
(
"
#{
shared
.
export_path
}
/avatar/"
)
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
stub_feature_flags
(
import_export_object_storage:
false
)
end
end
after
do
after
do
...
@@ -18,6 +19,8 @@ describe Gitlab::ImportExport::AvatarSaver do
...
@@ -18,6 +19,8 @@ describe Gitlab::ImportExport::AvatarSaver do
it
'saves a project avatar'
do
it
'saves a project avatar'
do
described_class
.
new
(
project:
project_with_avatar
,
shared:
shared
).
save
described_class
.
new
(
project:
project_with_avatar
,
shared:
shared
).
save
puts
"
#{
shared
.
export_path
}
/avatar/dk.png"
expect
(
File
).
to
exist
(
"
#{
shared
.
export_path
}
/avatar/dk.png"
)
expect
(
File
).
to
exist
(
"
#{
shared
.
export_path
}
/avatar/dk.png"
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment