summaryrefslogtreecommitdiff
path: root/spec/lib/banzai/reference_parser
Commit message (Collapse)AuthorAgeFilesLines
* Change all `:empty_project` to `:project`rs-empty_project-defaultRobert Speicher2017-08-029-14/+14
|
* Remove superfluous lib: true, type: redis, service: true, models: true, ↵Rémy Coutable2017-07-2710-10/+10
| | | | | | services: true, no_db: true, api: true Signed-off-by: Rémy Coutable <remy@rymai.me>
* Improve support for external issue referencesadam-external-issue-references-spikeAdam Niedzielski2017-06-301-10/+0
|
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-215-116/+116
|
* Merge branch 'dm-fix-parser-cache' into 'master'Sean McGivern2017-06-151-1/+1
|\ | | | | | | | | Don't return nil for missing objects from parser cache See merge request !12168
| * Don't return nil for missing objects from parser cachedm-fix-parser-cacheDouwe Maan2017-06-141-1/+1
| |
* | Correct RSpec/SingleLineHook cop offensesRobert Speicher2017-06-145-5/+15
|/
* Use :request_store hooks on specsuse-request-store-helper-instead-actual-codeOswaldo Ferreira2017-06-091-10/+1
|
* Merge branch '25934-project-snippet-vis' into 'security-9-2'DJ Mountney2017-06-082-6/+185
| | | | | | Fix visibility when referencing snippets See merge request !2101
* Fix /unsubscribe slash command creating extra todos33032-invalid-you-directly-addressed-yourself-todo-when-using-unsubscribeSean McGivern2017-05-301-1/+24
| | | | | | | | | | | | | | | | | | | | | | 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.
* Fix regression in rendering Markdown references that do not existsh-fix-base-parserStan Hu2017-04-151-2/+21
| | | | Closes #30972
* Add indication for closed or merged issuables in GFMadam-finish-5993-closed-issuableAdam Buckland2017-04-073-5/+34
| | | | | | | | | | | | | | | Example: for issues that are closed, the links will now show '[closed]' following the issue number. This is done as post-process after the markdown has been loaded from the cache as the status of the issue may change between the cache being populated and the content being displayed. In order to avoid N+1 queries problem when rendering notes ObjectRenderer populates the cache of referenced issuables for all notes at once, before the post processing phase. As a part of this change, the Banzai BaseParser#grouped_objects_for_nodes method has been refactored to return a Hash utilising the node itself as the key, since this was a common pattern of usage for this method.
* Use `:empty_project` where possible throughout spec/librs-empty_project-libRobert Speicher2017-01-251-3/+3
|
* Parse JIRA issue references even if Issue Tracker is disabledFelipe Artur2016-12-291-1/+11
|
* Merge branch 'issue_23548_dev' into 'master'Douwe Maan2016-11-0910-36/+72
| | | | | | | | | | | | | | | | | | | | | disable markdown in comments when referencing disabled features fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23548 This MR prevents the following references when tool is disabled: - issues - snippets - commits - when repo is disabled - commit range - when repo is disabled - milestones This MR does not prevent references to repository files, since they are just markdown links and don't leak information. See merge request !2011 Signed-off-by: Rémy Coutable <remy@rymai.me>
* remove Ability.abilitieshttp://jneen.net/2016-08-302-9/+9
|
* Method for returning issues readable by a userability-batch-issue-checkingYorick Peterse2016-07-291-6/+6
| | | | | | | | | | | | | The method Ability.issues_readable_by_user takes a list of users and an optional user and returns an Array of issues readable by said user. This method in turn is used by Banzai::ReferenceParser::IssueParser#nodes_visible_to_user so this method no longer needs to get all the available abilities just to check if a user has the "read_issue" ability. To test this I benchmarked an issue with 222 comments on my development environment. Using these changes the time spent in nodes_visible_to_user was reduced from around 120 ms to around 40 ms.
* Re-use queries in reference parsersreuse-queries-in-reference-parsersYorick Peterse2016-07-081-0/+75
| | | | | This caches various queries to ensure that multiple reference extraction runs re-use any objects queried in previous runs.
* Split Markdown rendering & reference gatheringYorick Peterse2016-05-2610-0/+923
This splits the Markdown rendering and reference extraction phases into two distinct code bases. The reference extraction phase no longer relies on the html-pipeline Gem (and any related code) and allows for extracting of references from multiple HTML nodes in a single pass. This means that if you want to extract user references from 200 comments you no longer need to run 200 times N number of queries, instead only a handful of queries may be needed.