gitlab-org--gitlab-foss/lib/banzai
Sean McGivern 172932eec8 Fix /unsubscribe slash command creating extra todos
The /unsubscribe slash command means that we check if the current user is
subscribed to the issuable without having an explicit subscription. That means
that we use the UserParser to find references to them in the notes.

The UserParser (and all parsers inheriting from BaseParser) use RequestStore to
cache ActiveRecord objects, so that we don't need to load the User object each
time, if we're parsing references a bunch of times in the same request.

However, it was always returning _all_ of the previously cached items, not just
the ones matching the IDs passed. This would mean that we did two runs through
with UserParser if you were mentioned in a comment, and then mentioned someone
else in your comment while using /unsubscribe:

1. Because /unsubscribe was used, we see if you were mentioned in any comments.
2. Because you mentioned someone, we find them - but we would also get back your
   user, even if you didn't mention yourself. This would have the effect of
   creating a mention or directly addressed todo for yourself incorrectly.

The fix is simple: only return values from the cache matching the IDs passed.
2017-05-30 11:24:55 +01:00
..
filter Merge branch '29852-latex-formatting' into 'master' 2017-05-24 15:03:09 +00:00
pipeline Fix LaTeX formatting for AsciiDoc wiki 2017-05-24 15:47:35 +02:00
reference_parser Fix /unsubscribe slash command creating extra todos 2017-05-30 11:24:55 +01:00
renderer Merge branch '30125-markdown-security' 2017-04-05 21:03:46 -07:00
cross_project_reference.rb replace `find_with_namespace` with `find_by_full_path` 2017-02-03 07:14:04 +07:00
filter.rb Remove redundant `require`s from Banzai files 2016-03-24 13:23:47 -04:00
filter_array.rb Add FilterArray class to Banzai 2016-03-01 15:54:35 -05:00
issuable_extractor.rb issues_for_nodes => issuables_for_nodes 2017-04-26 13:11:49 +08:00
note_renderer.rb Use CacheMarkdownField for notes 2016-10-07 02:54:26 +01:00
object_renderer.rb Add indication for closed or merged issuables in GFM 2017-04-07 14:31:43 -05:00
pipeline.rb Prevent circular reference error in Banzai 2016-01-14 11:30:28 +01:00
querying.rb Create directly_addressed Todos when mentioned in beginning of a line 2017-02-08 21:53:34 +05:30
redactor.rb Fix Markdown styling inside reference links 2016-11-01 09:49:30 +00:00
reference_extractor.rb Revert "Enable Style/DotPosition" 2017-02-23 09:33:19 -06:00
reference_parser.rb Split Markdown rendering & reference gathering 2016-05-26 17:14:00 +02:00
renderer.rb Start versioning cached markdown fields 2017-04-21 17:24:33 +01:00