Commit Graph

78 Commits

Author SHA1 Message Date
GitLab Bot 164ac94bbd Add latest changes from gitlab-org/gitlab@master 2023-09-05 12:11:04 +00:00
GitLab Bot 3b7f1f7e09 Add latest changes from gitlab-org/gitlab@master 2023-07-20 18:07:04 +00:00
GitLab Bot bd979acf95 Add latest changes from gitlab-org/gitlab@master 2023-05-04 18:09:51 +00:00
GitLab Bot 5103041796 Add latest changes from gitlab-org/gitlab@master 2023-03-10 12:11:10 +00:00
GitLab Bot 0c1344a7c1 Add latest changes from gitlab-org/gitlab@master 2023-03-09 12:15:54 +00:00
GitLab Bot 87f8fdb93c Add latest changes from gitlab-org/gitlab@master 2023-01-10 15:08:33 +00:00
GitLab Bot da03179135 Add latest changes from gitlab-org/gitlab@master 2022-12-23 03:10:18 +00:00
GitLab Bot 09b4875c00 Add latest changes from gitlab-org/gitlab@master 2022-12-20 12:09:21 +00:00
GitLab Bot 1690313142 Add latest changes from gitlab-org/gitlab@master 2022-12-08 21:09:17 +00:00
GitLab Bot 30b8ea126f Add latest changes from gitlab-org/gitlab@master 2022-10-31 18:09:25 +00:00
GitLab Bot b1928c08f1 Add latest changes from gitlab-org/gitlab@master 2022-10-13 18:10:20 +00:00
GitLab Bot b3e461ab0f Add latest changes from gitlab-org/gitlab@master 2022-10-07 00:08:16 +00:00
GitLab Bot fd1c75caeb Add latest changes from gitlab-org/gitlab@master 2022-08-02 03:09:33 +00:00
GitLab Bot d79bf171e4 Add latest changes from gitlab-org/gitlab@master 2022-07-26 09:09:02 +00:00
GitLab Bot a88c31d0ea Add latest changes from gitlab-org/gitlab@master 2022-07-13 15:09:14 +00:00
GitLab Bot ec3e75cfea Add latest changes from gitlab-org/gitlab@master 2022-06-15 21:10:04 +00:00
GitLab Bot b646822e52 Add latest changes from gitlab-org/gitlab@master 2022-06-03 06:10:04 +00:00
GitLab Bot 06b21ad63c Add latest changes from gitlab-org/gitlab@master 2022-03-16 21:09:14 +00:00
GitLab Bot cce7638874 Add latest changes from gitlab-org/gitlab@master 2022-03-08 15:15:55 +00:00
GitLab Bot 77b8390171 Add latest changes from gitlab-org/gitlab@master 2021-11-24 12:10:21 +00:00
GitLab Bot 63fd08e6b4 Add latest changes from gitlab-org/gitlab@master 2021-08-11 21:10:33 +00:00
GitLab Bot f7bc7dc5ea Add latest changes from gitlab-org/gitlab@master 2021-06-01 21:10:06 +00:00
GitLab Bot 0ae8428c8e Add latest changes from gitlab-org/gitlab@master 2021-05-11 21:10:21 +00:00
GitLab Bot 507c0e71cd Add latest changes from gitlab-org/gitlab@master 2021-01-27 12:09:01 +00:00
GitLab Bot ace0df53d3 Add latest changes from gitlab-org/gitlab@master 2020-11-30 18:09:46 +00:00
GitLab Bot e829ca213b Add latest changes from gitlab-org/gitlab@master 2020-06-22 15:09:27 +00:00
GitLab Bot 340fd2966e Add latest changes from gitlab-org/gitlab@master 2020-06-04 00:08:17 +00:00
GitLab Bot 100a5e4bea Add latest changes from gitlab-org/gitlab@master 2020-05-25 21:08:00 +00:00
GitLab Bot d80f3cd75e Add latest changes from gitlab-org/gitlab@master 2020-03-04 09:08:20 +00:00
GitLab Bot 0d6fa03312 Add latest changes from gitlab-org/gitlab@master 2020-02-06 18:08:54 +00:00
GitLab Bot 6b9d3a4e83 Add latest changes from gitlab-org/gitlab@master 2020-01-29 18:08:47 +00:00
GitLab Bot 5ad0cf2655 Add latest changes from gitlab-org/gitlab@master 2020-01-23 12:08:38 +00:00
GitLab Bot c158fa8d69 Add latest changes from gitlab-org/gitlab@master 2020-01-16 12:08:32 +00:00
GitLab Bot 0b12a5312c Add latest changes from gitlab-org/gitlab@master 2020-01-14 21:07:45 +00:00
GitLab Bot 85e494935a Add latest changes from gitlab-org/gitlab@master 2020-01-14 15:07:55 +00:00
GitLab Bot 8423ed74e6 Add latest changes from gitlab-org/gitlab@master 2019-11-02 15:06:18 +00:00
Luke Duncalfe 49a78d419d Pass all wiki markup formats through pipelines
Previously, when the wiki page format was anything other than `markdown`
or `asciidoc` the formatted content would be returned though a Gitaly
call. Gitaly in turn would delegate formatting to the gitlab-gollum-lib
gem, which in turn would delegate that to various gems (like RDoc for
`rdoc`) and then apply some very liberal sanitization.

It was too liberal!

This change brings our wiki content formatting in line with how we
format other markdown at GitLab, so we have a SSOT for sanitization.

https://gitlab.com/gitlab-org/gitlab/issues/30540
2019-10-23 11:42:37 +13:00
Vasiliy Yakliushin 3b40781e98 Extract plain file rendering into a separate method 2019-07-07 11:49:53 +02:00
Vasiliy Yakliushin 22e2217c95 Fix undefined method `simple_format for MarkupHelper:Module
`simple_format` is not defined in ActionView::Helpers::TagHelper, but
it is actually located in ActionView::Helpers::TextHelper.

The solution is to include the correct helper.

I've also added tests for `#markup_unsafe` because they were missing.
2019-07-07 11:49:53 +02:00
Bob Van Landuyt 406808583c Render GFM html in GraphQL
This adds a `markdown_field` to our types.

Using this helper will render a model's markdown field using the
existing `MarkupHelper` with the context of the GraphQL query
available to the helper.

Having the context available to the helper is needed for redacting
links to resources that the current user is not allowed to see.

Because rendering the HTML can cause queries, the complexity of a
these fields is raised by 5 above the default.

The markdown field helper can be used as follows:

      ```
      markdown_field :note_html, null: false
      ```

This would generate a field that will render the markdown field `note`
of the model. This could be overridden by adding the `method:`
argument. Passing a symbol for the method name:

      ```
      markdown_field :body_html, null: false, method: :note
      ```

It will have this description by default:

> The GitLab Flavored Markdown rendering of `note`

This could be overridden by passing a `description:` argument.

The type of a `markdown_field` is always `GraphQL::STRING_TYPE`.
2019-06-20 08:02:33 +00:00
Guillaume Grossetie 3f5d7c7e1c Add basic support for AsciiDoc include directive
See http://asciidoctor.org/docs/user-manual/#include-directive
2019-06-14 07:53:08 +00:00
Stan Hu b02458ef52 Fix slow performance with compiling HAML templates
In Rails 5, including `ActionView::Context` can have a significant and
hidden performance penalty because this module also includes
`ActionView::CompiledTemplates`. This means that any module that
includes ActionView::Context becomes a descendant of
`CompiledTemplates`.

When a partial is rendered for the first time, it runs
`ActionView::CompiledTemplates#module_eval`, which will evaluate a
string that defines a new method for that partial. For example, the
source of partial might be this string:

```
def _app_views_project_show_html_haml___12345(local_assigns, output)
  "hello world"
end
```

When this string is evaluated, the Ruby interpreter will define the
method and clear the global method cache for all descendants of
`ActionView::CompiledTemplates`. Previous to this change, we
inadvertently made a number of modules fall into this category:

* GroupChildEntity
* NoteUserEntity
* Notify
* MergeRequestUserEntity
* AnalyticsCommitEntity
* CommitEntity
* UserEntity
* Kaminari::Helpers::Paginator
* CurrentUserEntity
* ActionView::Base
* ActionDispatch::DebugExceptions::DebugView
* MarkupHelper
* MergeRequestPresenter

After this change:

* Kaminari::Helpers::Paginator
* ActionView::Base
* ActionDispatch::DebugExceptions::DebugView

Each time a partial is rendered for the first time, all methods for
those modules will have to be redefined. This can exact a significant
performance penalty.

How bad is this penalty? Using the following benchmark script, we can
use DTrace to sample the Ruby interpreter:

```
Benchmark.bm do |x|
  x.report do
    1000.times do
      ActionView::CompiledTemplates.module_eval("def testme\nend")
    end
  end
end
```

This revealed a 11x jump in the time spent in `core#define_method`
alone.

Rails 6 fixes this behavior by moving the `include CompiledTemplates`
into ActionView::Base so that including `ActionView::Context` doesn't
quietly affect other modules in this way.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/11198
2019-04-29 05:33:50 -07:00
Sam Bigelow 699957ef59 Resolve "Merge Request Popover is not working on the To Do page" 2019-04-24 14:09:36 +00:00
Dmitriy Zaporozhets da026ac2ec Remove rails-deprecated_sanitizer dependency
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2019-04-12 16:42:32 +03:00
Andrew Newdigate 3288e1a874 Adds the Rubocop ReturnNil cop
This style change enforces `return if ...` instead of
`return nil if ...` to save maintainers a few minor review points
2019-03-06 17:51:56 +02:00
Jan Provaznik b2c70230b3 Remove Redcarpet markdown engine
This engine was replaced with CommonMarker in 11.4, it was deprecated
since then.
2019-02-04 12:48:35 +01:00
Brett Walker 635d901288 Remove images in 'first_line_in_markdown'
By default, we now strip images in the 'first_line_in_markdown'
method.  This keeps images from being displayed in the
one-liner of both todo and project activity panels.

Although not currently used, we allow images to be preserved
with the allow_images: true options.
2018-09-13 10:33:06 -05:00
gfyoung 1993a4449a Enable frozen string for app/helpers/**/*.rb
Partially addresses #47424.
2018-09-06 17:33:46 -07:00
Brett Walker c4f26d4b1c added feature flag 'commonmark_for_repositories' 2018-09-05 09:19:16 -05:00
Brett Walker 589776fc2e move logic into legacy_render_context helper method 2018-09-05 09:19:16 -05:00