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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
eff8f975
Commit
eff8f975
authored
Jul 19, 2019
by
Alex Kalderimis
Committed by
Jan Provaznik
Jul 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid incorrect cached values
this fixes
https://gitlab.com/gitlab-org/gitlab-ee/issues/12780
parent
b40c044f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
ee/app/services/design_management/save_designs_service.rb
ee/app/services/design_management/save_designs_service.rb
+9
-3
ee/changelogs/unreleased/multiple-design-uploaded.yml
ee/changelogs/unreleased/multiple-design-uploaded.yml
+4
-0
ee/spec/services/design_management/save_designs_service_spec.rb
...c/services/design_management/save_designs_service_spec.rb
+4
-0
No files found.
ee/app/services/design_management/save_designs_service.rb
View file @
eff8f975
...
@@ -34,16 +34,22 @@ module DesignManagement
...
@@ -34,16 +34,22 @@ module DesignManagement
def
create_and_commit_designs!
def
create_and_commit_designs!
repository
.
create_if_not_exists
repository
.
create_if_not_exists
repository_actions
=
files
.
map
do
|
file
|
# Do not inline `build_repository_action` here!
design
=
collection
.
find_or_create_design!
(
filename:
file
.
original_filename
)
# We have to do this as two *separate* calls to #map so that the call
# to `new_file?` does not accidentally cache the wrong data half-way
# through the operation.
corresponding_designs
=
files
.
map
do
|
file
|
collection
.
find_or_create_design!
(
filename:
file
.
original_filename
)
end
actions
=
files
.
zip
(
corresponding_designs
).
map
do
|
(
file
,
design
)
|
build_repository_action
(
file
,
design
)
build_repository_action
(
file
,
design
)
end
end
repository
.
multi_action
(
current_user
,
repository
.
multi_action
(
current_user
,
branch_name:
target_branch
,
branch_name:
target_branch
,
message:
commit_message
,
message:
commit_message
,
actions:
repository_
actions
)
actions:
actions
)
end
end
def
build_repository_action
(
file
,
design
)
def
build_repository_action
(
file
,
design
)
...
...
ee/changelogs/unreleased/multiple-design-uploaded.yml
0 → 100644
View file @
eff8f975
---
title
:
'
Fixes
#12780
by
avoiding
incorrect
cached
values'
merge_request
:
14651
type
:
fixed
ee/spec/services/design_management/save_designs_service_spec.rb
View file @
eff8f975
...
@@ -140,6 +140,10 @@ describe DesignManagement::SaveDesignsService do
...
@@ -140,6 +140,10 @@ describe DesignManagement::SaveDesignsService do
]
]
end
end
it
'returns information about both designs in the response'
do
expect
(
service
.
execute
).
to
include
(
designs:
have_attributes
(
size:
2
),
status: :success
)
end
it
"creates 2 designs with a single version"
do
it
"creates 2 designs with a single version"
do
expect
{
service
.
execute
}.
to
change
{
issue
.
designs
.
count
}.
from
(
0
).
to
(
2
)
expect
{
service
.
execute
}.
to
change
{
issue
.
designs
.
count
}.
from
(
0
).
to
(
2
)
expect
(
DesignManagement
::
Version
.
for_designs
(
issue
.
designs
).
size
).
to
eq
(
1
)
expect
(
DesignManagement
::
Version
.
for_designs
(
issue
.
designs
).
size
).
to
eq
(
1
)
...
...
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