diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-05-02 16:24:41 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-02 16:24:41 +0300 |
commit | 3dd2476eb395ca706763210ef1f37978889c595d (patch) | |
tree | 298508bd9cf34436c3957376a16fe9b00e20e490 /app/models/concerns/cache_markdown_field.rb | |
parent | ffc486a58547b6984a44a43097183b34592be608 (diff) |
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.
Diffstat (limited to 'app/models/concerns/cache_markdown_field.rb')
-rw-r--r-- | app/models/concerns/cache_markdown_field.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/concerns/cache_markdown_field.rb b/app/models/concerns/cache_markdown_field.rb index f033028c4e5..eb32bf3d32a 100644 --- a/app/models/concerns/cache_markdown_field.rb +++ b/app/models/concerns/cache_markdown_field.rb @@ -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 |