Commit Graph

12 Commits

Author SHA1 Message Date
GitLab Bot 0ae8428c8e Add latest changes from gitlab-org/gitlab@master 2021-05-11 21:10:21 +00:00
GitLab Bot a9ced7da44 Add latest changes from gitlab-org/gitlab@master 2020-04-09 12:09:24 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Dinesh Panda 736b5908da Avoid calling freeze on already frozen strings in lib 2019-09-10 08:11:43 +00:00
Jarka Košanová 1d7737ae86 Prepare Banzai to work with group issuables 2018-10-31 16:04:48 +01:00
gfyoung d598e4fd93 Enable more frozen string in lib/**/*.rb
Enables frozen for the following:

* lib/*.rb
* lib/banzai/**/*.rb
* lib/bitbucket/**/*.rb
* lib/constraints/**/*.rb
* lib/container_registry/**/*.rb
* lib/declarative_policy/**/*.rb

Partially addresses #47424.
2018-10-06 17:02:50 -07:00
Yorick Peterse daad7144ec
Support Markdown rendering using multiple projects
This refactors the Markdown pipeline so it supports the rendering of
multiple documents that may belong to different projects. An example of
where this happens is when displaying the event feed of a group. In this
case we retrieve events for all projects in the group. Previously we
would group events per project and render these chunks separately, but
this would result in many SQL queries being executed. By extending the
Markdown pipeline to support this out of the box we can drastically
reduce the number of SQL queries.

To achieve this we introduce a new object to the pipeline:
Banzai::RenderContext. This object simply wraps two other objects: an
optional Project instance, and an optional User instance. On its own
this wouldn't be very helpful, but a RenderContext can also be used to
associate HTML documents with specific Project instances. This work is
done in Banzai::ObjectRenderer and allows us to reuse as many queries
(and results) as possible.
2018-04-11 14:10:19 +02:00
Jarka Kadlecova 0c2fdb1c34 Refactor banzai to support referencing from group context 2017-12-06 19:16:22 +01:00
Lin Jen-Shin 68fa16a57c issues_for_nodes => issuables_for_nodes 2017-04-26 13:11:49 +08:00
Lin Jen-Shin 9f7c29baef Follow feedback on the review 2017-04-26 02:38:59 +08:00
Lin Jen-Shin 4ded8b1cc0 Skip issuable without a project in IssuableExtractor#extract
Closes #31280
2017-04-25 18:39:41 +08:00
Adam Buckland ace833b31d Add indication for closed or merged issuables in GFM
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.
2017-04-07 14:31:43 -05:00