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
bb8fdcc1
Commit
bb8fdcc1
authored
Jan 31, 2019
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments
parent
0e6c08f5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
129 deletions
+128
-129
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+18
-17
app/services/task_list_toggle_service.rb
app/services/task_list_toggle_service.rb
+1
-1
spec/models/concerns/cache_markdown_field_spec.rb
spec/models/concerns/cache_markdown_field_spec.rb
+1
-1
spec/services/task_list_toggle_service_spec.rb
spec/services/task_list_toggle_service_spec.rb
+108
-110
No files found.
app/services/issuable_base_service.rb
View file @
bb8fdcc1
...
@@ -239,8 +239,9 @@ class IssuableBaseService < BaseService
...
@@ -239,8 +239,9 @@ class IssuableBaseService < BaseService
filter_params
(
issuable
)
filter_params
(
issuable
)
if
issuable
.
changed?
||
params
.
present?
if
issuable
.
changed?
||
params
.
present?
issuable
.
assign_attributes
(
params
.
merge
(
updated_by:
current_user
))
issuable
.
assign_attributes
(
params
.
merge
(
updated_by:
current_user
,
issuable
.
assign_attributes
(
last_edited_at:
Time
.
now
,
last_edited_by:
current_user
)
last_edited_at:
Time
.
now
,
last_edited_by:
current_user
))
before_update
(
issuable
)
before_update
(
issuable
)
...
@@ -268,12 +269,16 @@ class IssuableBaseService < BaseService
...
@@ -268,12 +269,16 @@ class IssuableBaseService < BaseService
tasklist_toggler
=
TaskListToggleService
.
new
(
issuable
.
description
,
issuable
.
description_html
,
tasklist_toggler
=
TaskListToggleService
.
new
(
issuable
.
description
,
issuable
.
description_html
,
line_source:
update_task_params
[
:line_source
],
line_source:
update_task_params
[
:line_source
],
line_number:
update_task_params
[
:line_number
],
line_number:
update_task_params
[
:line_number
]
.
to_i
,
toggle_as_checked:
update_task_params
[
:checked
],
toggle_as_checked:
update_task_params
[
:checked
],
index:
update_task_params
[
:index
],
index:
update_task_params
[
:index
]
.
to_i
,
sourcepos:
!
issuable
.
legacy_markdown?
)
sourcepos:
!
issuable
.
legacy_markdown?
)
if
tasklist_toggler
.
execute
unless
tasklist_toggler
.
execute
# if we make it here, the data is much newer than we thought it was - fail fast
raise
ActiveRecord
::
StaleObjectError
end
# by updating the description_html field at the same time,
# by updating the description_html field at the same time,
# the markdown cache won't be considered invalid
# the markdown cache won't be considered invalid
params
[
:description
]
=
tasklist_toggler
.
updated_markdown
params
[
:description
]
=
tasklist_toggler
.
updated_markdown
...
@@ -285,10 +290,6 @@ class IssuableBaseService < BaseService
...
@@ -285,10 +290,6 @@ class IssuableBaseService < BaseService
params
[
:lock_version
]
=
issuable
.
lock_version
params
[
:lock_version
]
=
issuable
.
lock_version
update_task
(
issuable
)
update_task
(
issuable
)
else
# if we make it here, the data is much newer than we thought it was - fail fast
raise
ActiveRecord
::
StaleObjectError
end
end
end
def
labels_changing?
(
old_label_ids
,
new_label_ids
)
def
labels_changing?
(
old_label_ids
,
new_label_ids
)
...
...
app/services/task_list_toggle_service.rb
View file @
bb8fdcc1
...
@@ -23,7 +23,7 @@ class TaskListToggleService
...
@@ -23,7 +23,7 @@ class TaskListToggleService
def
execute
def
execute
return
false
unless
markdown
&&
markdown_html
return
false
unless
markdown
&&
markdown_html
!!
(
toggle_markdown
&&
toggle_markdown_html
)
toggle_markdown
&&
toggle_markdown_html
end
end
private
private
...
...
spec/models/concerns/cache_markdown_field_spec.rb
View file @
bb8fdcc1
...
@@ -133,7 +133,7 @@ describe CacheMarkdownField do
...
@@ -133,7 +133,7 @@ describe CacheMarkdownField do
end
end
end
end
context
'when a markdown field and html field are both
set
'
do
context
'when a markdown field and html field are both
changed
'
do
it
do
it
do
expect
(
thing
).
not_to
receive
(
:refresh_markdown_cache
)
expect
(
thing
).
not_to
receive
(
:refresh_markdown_cache
)
thing
.
foo
=
'_look over there!_'
thing
.
foo
=
'_look over there!_'
...
...
spec/services/task_list_toggle_service_spec.rb
View file @
bb8fdcc1
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
require
'spec_helper'
require
'spec_helper'
describe
TaskListToggleService
do
describe
TaskListToggleService
do
context
'when '
do
let
(
:sourcepos
)
{
true
}
let
(
:sourcepos
)
{
true
}
let
(
:markdown
)
do
let
(
:markdown
)
do
<<-
EOT
.
strip_heredoc
<<-
EOT
.
strip_heredoc
...
@@ -124,5 +123,4 @@ describe TaskListToggleService do
...
@@ -124,5 +123,4 @@ describe TaskListToggleService do
it_behaves_like
'task lists'
it_behaves_like
'task lists'
end
end
end
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