Skip to content
Snippets Groups Projects
Commit 3dd2476e authored by Bob Van Landuyt :neckbeard:'s avatar Bob Van Landuyt :neckbeard: :sunglasses:
Browse files

Refresh the markdown cache if it was `nil`

If the cached html_field for a markdown_field is `nil` while the
mfarkdown_field is not, it needs to be refreshed.
parent ffc486a5
No related branches found
No related tags found
1 merge request!10413Reject more reserved paths
Pipeline #
Loading
Loading
@@ -78,6 +78,9 @@ module CacheMarkdownField
def cached_html_up_to_date?(markdown_field)
html_field = cached_markdown_fields.html_field(markdown_field)
 
cached = !cached_html_for(markdown_field).nil? && !__send__(markdown_field).nil?
return false unless cached
markdown_changed = attribute_changed?(markdown_field) || false
html_changed = attribute_changed?(html_field) || false
 
Loading
Loading
Loading
Loading
@@ -170,6 +170,12 @@ describe CacheMarkdownField do
 
is_expected.to be_truthy
end
it 'returns false if the markdown field is set but the html is not' do
thing.foo_html = nil
is_expected.to be_falsy
end
end
 
describe '#refresh_markdown_cache!' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment