Skip to content
Snippets Groups Projects
  1. Jan 14, 2020
  2. Nov 02, 2019
  3. Oct 22, 2019
    • Luke Duncalfe's avatar
      Pass all wiki markup formats through pipelines · 49a78d41
      Luke Duncalfe authored
      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
      49a78d41
  4. Jul 07, 2019
  5. Jun 20, 2019
    • Bob Van Landuyt :neckbeard:'s avatar
      Render GFM html in GraphQL · 40680858
      Bob Van Landuyt :neckbeard: authored and Douwe Maan's avatar Douwe Maan committed
      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`.
      40680858
  6. Jun 14, 2019
  7. Apr 29, 2019
    • Stan Hu's avatar
      Fix slow performance with compiling HAML templates · b02458ef
      Stan Hu authored
      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
      b02458ef
  8. Apr 24, 2019
  9. Apr 12, 2019
  10. Mar 06, 2019
  11. Feb 04, 2019
  12. Sep 13, 2018
    • Brett Walker's avatar
      Remove images in 'first_line_in_markdown' · 635d9012
      Brett Walker authored
      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.
      635d9012
  13. Sep 07, 2018
  14. Sep 05, 2018
  15. Jul 06, 2018
  16. Apr 11, 2018
    • Yorick Peterse's avatar
      Support Markdown rendering using multiple projects · daad7144
      Yorick Peterse authored
      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.
      Unverified
      daad7144
  17. Jan 11, 2018
  18. Dec 06, 2017
  19. Dec 04, 2017
  20. Nov 19, 2017
  21. Nov 16, 2017
  22. Nov 06, 2017
  23. Sep 06, 2017
  24. May 18, 2017
    • Toon Claes's avatar
      Fix ProjectCacheWorker for plain READMEs · abc82a25
      Toon Claes authored
      The ProjectCacheWorker refreshes cache periodically, but it runs outside Rails
      context. So include the ActionView helpers so the `content_tag` method is
      available.
      abc82a25
  25. May 10, 2017
  26. Apr 28, 2017
  27. Apr 27, 2017
Loading