Commit 67bfef2c authored by Sean McGivern's avatar Sean McGivern

Merge branch '337543-fix-markdown-cache' into 'master'

Markdown cache of `nil` breaks migrations [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!67443
parents fa1cb1ad 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
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment