gitlab-org--gitlab-foss/lib/banzai/reference_parser
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
..
base_parser.rb Fix /unsubscribe slash command creating extra todos 2017-05-30 11:24:55 +01:00
commit_parser.rb Merge branch 'issue_23548_dev' into 'master' 2016-11-09 12:25:17 +01:00
commit_range_parser.rb Merge branch 'issue_23548_dev' into 'master' 2016-11-09 12:25:17 +01:00
directly_addressed_user_parser.rb Create directly_addressed Todos when mentioned in beginning of a line 2017-02-08 21:53:34 +05:30
external_issue_parser.rb Merge branch 'issue_23548_dev' into 'master' 2016-11-09 12:25:17 +01:00
issue_parser.rb Backport of multiple_assignees_feature [ci skip] 2017-05-04 17:11:53 +03:00
label_parser.rb Merge branch 'issue_23548_dev' into 'master' 2016-11-09 12:25:17 +01:00
merge_request_parser.rb Remove N+1 queries when checking nodes visible to user 2017-05-02 17:35:19 +01:00
milestone_parser.rb Merge branch 'issue_23548_dev' into 'master' 2016-11-09 12:25:17 +01:00
snippet_parser.rb Merge branch 'issue_23548_dev' into 'master' 2016-11-09 12:25:17 +01:00
user_parser.rb Add indication for closed or merged issuables in GFM 2017-04-07 14:31:43 -05:00