• Nick Thomas's avatar
    Improve cache sharing between cached markdown fields and mentionables · c0e6dd6a
    Nick Thomas authored
    This change makes an item of implicit coupling between the Mentionable
    and CachedMarkdownField concerns. Mentionable needs to render the
    fields it depends on to extract references; when those fields are also
    cached markdown fields, it currently uses that cache to skip the render
    step.
    
    For the Commit model, we couldn't share the cache because Mentionable
    was looking at safe_message, while CachedMarkdownField was looking at
    `title`, `full_title`, and `description`. However, the combination of
    the latter two is equivalent to `safe_message`, so we can use them
    instead.
    
    This opens up a couple of cans of worms - in particular, we now call
    Commit#store_mentions!, which we've never done before. However, it all
    seems to work out in the end.
    
    Changelog: performance
    c0e6dd6a
commit.rb 13.8 KB