Broken memoization of mentions in posts

(Darren Lee) #1

I believe that there’s a minor typo on line 63 of post_analyzer.rb that is preventing memoization of mentions in posts:

In particular, the line is missing an ‘s’ and should be @raw_mentions = raw_mentions.

There is no functional impact of this – both post_spec and post_analyzer_spec pass with and without the correction. The net effect is simply that the mentions are recomputed each time the method is called.

As far as I can tell, there are no references to the singular raw_mention variable: egrep -irn 'raw_mention\b' . --include '*.rb' doesn’t come up with any results other than this single line. While I haven’t written any failing tests of the memoization behavior, I think that this is a pretty obvious bug.

(Joffrey Jaffeux) #2

Good catch, clearly looks like a typo to me given:

(Darren Lee) #3

PR: FIX: memoization in PostAnalyzer.raw_mentions by balshor · Pull Request #5172 · discourse/discourse · GitHub

(Jeff Atwood) closed #4