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
3473ab1f
Commit
3473ab1f
authored
Aug 03, 2021
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that cached_markdown_version is not nil
parent
858320c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
lib/gitlab/markdown_cache/active_record/extension.rb
lib/gitlab/markdown_cache/active_record/extension.rb
+1
-1
spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb
...lib/gitlab/markdown_cache/active_record/extension_spec.rb
+12
-0
No files found.
lib/gitlab/markdown_cache/active_record/extension.rb
View file @
3473ab1f
...
...
@@ -39,7 +39,7 @@ module Gitlab
def
save_markdown
(
updates
)
return
unless
persisted?
&&
Gitlab
::
Database
.
read_write?
return
if
cached_markdown_version
<
cached_markdown_version_in_database
return
if
cached_markdown_version
.
to_i
<
cached_markdown_version_in_database
.
to_i
update_columns
(
updates
)
end
...
...
spec/lib/gitlab/markdown_cache/active_record/extension_spec.rb
View file @
3473ab1f
...
...
@@ -228,4 +228,16 @@ RSpec.describe Gitlab::MarkdownCache::ActiveRecord::Extension do
thing
.
refresh_markdown_cache!
end
end
context
'when persisted cache is nil'
do
before
do
thing
.
update_column
(
:cached_markdown_version
,
nil
)
end
it
'does not save the generated HTML'
do
expect
(
thing
).
to
receive
(
:update_columns
)
thing
.
refresh_markdown_cache!
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