summaryrefslogtreecommitdiff
path: root/lib/banzai/reference_parser
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'sh-fix-base-parser' into 'master' Robert Speicher2017-04-171-1/+2
| | | | | | | Fix regression in rendering Markdown references that do not exist Closes #30972 See merge request !10716
* Add indication for closed or merged issuables in GFMadam-finish-5993-closed-issuableAdam Buckland2017-04-074-19/+25
| | | | | | | | | | | | | | | 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 Enumerable#index_by where possibledm-use-index-byDouwe Maan2017-03-161-3/+1
|
* use a magic default :global symbol instead of nilhttp://jneen.net/2017-03-091-1/+1
| | | | to make sure we mean the global permissions
* Create directly_addressed Todos when mentioned in beginning of a lineErshad Kunnakkadan2017-02-082-2/+11
|
* Merge branch 'issue_23548_dev' into 'master'Douwe Maan2016-11-099-14/+78
| | | | | | | | | | | | | | | | | | | | | 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>
* Avoid database queries on Banzai::ReferenceParser::BaseParser for nodes ↵22681-avoid-empty-queries-on-reference-parsersPaco Guzman2016-09-281-1/+5
| | | | without references
* remove Ability.abilitieshttp://jneen.net/2016-08-301-1/+1
|
* Method for returning issues readable by a userability-batch-issue-checkingYorick Peterse2016-07-291-3/+4
| | | | | | | | | | | | | 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-082-4/+37
| | | | | This caches various queries to ensure that multiple reference extraction runs re-use any objects queried in previous runs.
* Eager load project relations in IssueParserYorick Peterse2016-06-151-1/+15
| | | | | | | | | | | | | By eager loading these associations we can greatly cut down the number of SQL queries executed when processing documents with lots of references, especially in cases where there are references belonging to the same project. Since these associations are so specific to the reference parsing process and the permissions checking process that follows it I opted to include them directly in IssueParser instead of using something like a scope. Once we have a need for it we can move this code to a scope or method.
* Split Markdown rendering & reference gatheringYorick Peterse2016-05-2610-0/+477
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.