diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-01-25 11:23:25 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-01-25 11:23:25 -0600 |
commit | 21755ac9e9e349c4291e6f64109abe0b4588436d (patch) | |
tree | e8123e81ef63ebd7d9936042d6bd3a66e6a8760d /lib/banzai | |
parent | 43dc6263526dbbb7dab44d91406c36b07ce2829b (diff) | |
parent | b55c1bc4b5fb8d259ba9f264eff607f81012fa39 (diff) | |
download | gitlab-ce-21755ac9e9e349c4291e6f64109abe0b4588436d.tar.gz |
Merge branch 'master' into copy-as-md
# Conflicts:
# app/assets/javascripts/lib/utils/common_utils.js.es6
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/reference_filter.rb | 4 | ||||
-rw-r--r-- | lib/banzai/filter/user_reference_filter.rb | 4 | ||||
-rw-r--r-- | lib/banzai/renderer.rb | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/banzai/filter/reference_filter.rb b/lib/banzai/filter/reference_filter.rb index ab7af1cad21..6640168bfa2 100644 --- a/lib/banzai/filter/reference_filter.rb +++ b/lib/banzai/filter/reference_filter.rb @@ -53,6 +53,10 @@ module Banzai context[:project] end + def skip_project_check? + context[:skip_project_check] + end + def reference_class(type) "gfm gfm-#{type} has-tooltip" end diff --git a/lib/banzai/filter/user_reference_filter.rb b/lib/banzai/filter/user_reference_filter.rb index f842b1fb779..1aa9355b256 100644 --- a/lib/banzai/filter/user_reference_filter.rb +++ b/lib/banzai/filter/user_reference_filter.rb @@ -24,7 +24,7 @@ module Banzai end def call - return doc if project.nil? + return doc if project.nil? && !skip_project_check? ref_pattern = User.reference_pattern ref_pattern_start = /\A#{ref_pattern}\z/ @@ -58,7 +58,7 @@ module Banzai # have `gfm` and `gfm-project_member` class names attached for styling. def user_link_filter(text, link_content: nil) self.class.references_in(text) do |match, username| - if username == 'all' + if username == 'all' && !skip_project_check? link_to_all(link_content: link_content) elsif namespace = namespaces[username] link_to_namespace(namespace, link_content: link_content) || match diff --git a/lib/banzai/renderer.rb b/lib/banzai/renderer.rb index f31fb6c3f71..74663556cbb 100644 --- a/lib/banzai/renderer.rb +++ b/lib/banzai/renderer.rb @@ -52,9 +52,9 @@ module Banzai end # Same as +render_field+, but without consulting or updating the cache field - def cacheless_render_field(object, field) + def cacheless_render_field(object, field, options = {}) text = object.__send__(field) - context = object.banzai_render_context(field) + context = object.banzai_render_context(field).merge(options) cacheless_render(text, context) end |