Commit Graph

10 Commits

Author SHA1 Message Date
Juliette de Rancourt 8501e13bbc Resolve "Use "moved" instead of "closed" in issue references" 2019-08-30 06:16:01 +00:00
Jarka Košanová 1d7737ae86 Prepare Banzai to work with group issuables 2018-10-31 16:04:48 +01:00
Stan Hu 8b4154b57f Enable frozen strings in lib/banzai/filter/*.rb
Excludes a few filters that require more work:

* lib/banzai/filter/image_lazy_load_filter_spec.rb
* lib/banzai/filter/syntax_highlight_filter_spec.rb
* lib/banzai/filter/table_of_contents_filter_spec.rb

Part of #47424
2018-07-23 02:39:45 -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
Jan Provaznik 204ab7c9f8 Fix issuable state indicator
Now the issuable reference check works only in project scope, if we
reference an issuable from a non-project resource (e.g. epics), then
project is not set, and there is mismatch in generated issue references.

This patch enables issuable reference state check also from group scope.

Closes gitlab-ee#4683
Related to #30916
2018-03-23 10:04:44 +01:00
Bob Van Landuyt 148816cd67 Port `read_cross_project` ability from EE 2018-02-22 17:11:36 +01:00
Adam Niedzielski 1269ee4c3b Do not append issuable state to links with custom anchor
Closes #30916
Change the presentation from [closed] to (closed)
2017-04-19 18:36:12 +02:00
Adam Niedzielski de71a46594 Display issuable state only in notes and issuable description
Closes #30964
2017-04-19 16:38:46 +02:00
Adam Niedzielski 551d0a3c03 Fix appending state to issuable references
Closes #30874.
Ignore nodes with no children.
Append directly to the node instead of the last child of the node
to avoid inheriting formatting from the last child
2017-04-13 17:09:30 +02: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