summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-09-14 11:16:56 +0300
committerValery Sizov <vsv2711@gmail.com>2015-09-14 11:16:56 +0300
commit25149ce47eae575b65eb9470d58ea4f71b3b2603 (patch)
tree01183c76724971d239ea596bcc9bc6253fc74dd2 /lib
parentad5d2c3e78e56cb00f608020d1b3a7980f4ac6f4 (diff)
parent15eeae5fa8f10442617d2edd8fc3d8f5b3f334db (diff)
downloadgitlab-ce-25149ce47eae575b65eb9470d58ea4f71b3b2603.tar.gz
Merge branch 'ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g' of gitlab.com:gitlab-org/gitlab-ce into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g
Diffstat (limited to 'lib')
-rw-r--r--lib/api/services.rb10
-rw-r--r--lib/gitlab/markdown.rb2
-rw-r--r--lib/gitlab/markdown/sanitization_filter.rb12
-rw-r--r--lib/gitlab/markdown/syntax_highlight_filter.rb8
-rw-r--r--lib/tasks/services.rake9
5 files changed, 35 insertions, 6 deletions
diff --git a/lib/api/services.rb b/lib/api/services.rb
index 6d2322bb464..6727e80ac1e 100644
--- a/lib/api/services.rb
+++ b/lib/api/services.rb
@@ -49,6 +49,16 @@ module API
end
end
end
+
+ # Get <service_slug> service settings for project
+ #
+ # Example Request:
+ #
+ # GET /project/:id/services/gitlab-ci
+ #
+ get ':id/services/:service_slug' do
+ present project_service
+ end
end
end
end
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 097caf67a65..ae5f2544691 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -77,7 +77,7 @@ module Gitlab
pipeline: options[:pipeline],
# EmojiFilter
- asset_root: Gitlab.config.gitlab.url,
+ asset_root: Gitlab.config.gitlab.base_url,
asset_host: Gitlab::Application.config.asset_host,
# TableOfContentsFilter
diff --git a/lib/gitlab/markdown/sanitization_filter.rb b/lib/gitlab/markdown/sanitization_filter.rb
index 68ed57f6257..e368de7d848 100644
--- a/lib/gitlab/markdown/sanitization_filter.rb
+++ b/lib/gitlab/markdown/sanitization_filter.rb
@@ -67,12 +67,16 @@ module Gitlab
def clean_spans
lambda do |env|
- return unless env[:node_name] == 'span'
- return unless env[:node].has_attribute?('class')
+ node = env[:node]
- unless has_ancestor?(env[:node], 'pre')
- env[:node].remove_attribute('class')
+ return unless node.name == 'span'
+ return unless node.has_attribute?('class')
+
+ unless has_ancestor?(node, 'pre')
+ node.remove_attribute('class')
end
+
+ { node_whitelist: [node] }
end
end
end
diff --git a/lib/gitlab/markdown/syntax_highlight_filter.rb b/lib/gitlab/markdown/syntax_highlight_filter.rb
index 86f4385753a..8597e02f0de 100644
--- a/lib/gitlab/markdown/syntax_highlight_filter.rb
+++ b/lib/gitlab/markdown/syntax_highlight_filter.rb
@@ -21,7 +21,13 @@ module Gitlab
language = node.attr('class')
code = node.text
- highlighted = block_code(code, language)
+ begin
+ highlighted = block_code(code, language)
+ rescue
+ # Gracefully handle syntax highlighter bugs/errors to ensure
+ # users can still access an issue/comment/etc.
+ highlighted = "<pre>#{code}</pre>"
+ end
# Replace the parent `pre` element with the entire highlighted block
node.parent.replace(highlighted)
diff --git a/lib/tasks/services.rake b/lib/tasks/services.rake
index 3f276a5e12e..39541c0b9c6 100644
--- a/lib/tasks/services.rake
+++ b/lib/tasks/services.rake
@@ -40,6 +40,15 @@ DELETE /projects/:id/services/<%= service[:dashed_name] %>
```
+### Get <%= service[:title] %> service settings
+
+Get <%= service[:title] %> service settings for a project.
+
+```
+GET /projects/:id/services/<%= service[:dashed_name] %>
+
+```
+
<% end %>
ERB