summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG14
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock6
-rw-r--r--app/assets/stylesheets/generic/forms.scss1
-rw-r--r--app/assets/stylesheets/pages/notes.scss4
-rw-r--r--app/helpers/blob_helper.rb6
-rw-r--r--app/views/projects/_issuable_form.html.haml9
-rw-r--r--app/views/projects/merge_requests/show/_mr_accept.html.haml8
-rw-r--r--lib/gitlab/markdown.rb4
-rw-r--r--lib/gitlab/markdown/sanitization_filter.rb35
-rw-r--r--lib/gitlab/markdown/task_list_filter.rb23
-rw-r--r--spec/lib/gitlab/markdown/task_list_filter_spec.rb14
12 files changed, 94 insertions, 32 deletions
diff --git a/CHANGELOG b/CHANGELOG
index aea66986e30..3829cdb5237 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@ v 7.12.0 (unreleased)
- Fix resolving of relative links to repository files in AsciiDoc documents. (Jakub Jirutka)
v 7.11.0 (unreleased)
+ - Fall back to Plaintext when Syntaxhighlighting doesn't work. Fixes some buggy lexers (Hannes Rosenögger)
- Fix broken view when viewing history of a file that includes a path that used to be another file (Stan Hu)
- Don't show duplicate deploy keys
- Fix commit time being displayed in the wrong timezone in some cases (Hannes Rosenögger)
@@ -17,8 +18,6 @@ v 7.11.0 (unreleased)
- Don't allow a merge request to be merged when its title starts with "WIP".
- Add a page title to every page.
- Allow primary email to be set to an email that you've already added.
- - Fix Error 500 when searching Wiki pages (Stan Hu)
- - Get Gitorious importer to work again.
- Fix clone URL field and X11 Primary selection (Dmitry Medvinsky)
- Ignore invalid lines in .gitmodules
- Fix "Cannot move project" error message from popping up after a successful transfer (Stan Hu)
@@ -27,7 +26,6 @@ v 7.11.0 (unreleased)
- Fix "Revspec not found" errors when viewing diffs in a forked project with submodules (Stan Hu)
- Improve project page UI
- Fix broken file browsing with relative submodule in personal projects (Stan Hu)
- - Fix DB error when trying to tag a repository (Stan Hu)
- Add "Reply quoting selected text" shortcut key (`r`)
- Fix bug causing `@whatever` inside an issue's first code block to be picked up as a user mention.
- Fix bug causing `@whatever` inside an inline code snippet (backtick-style) to be picked up as a user mention.
@@ -46,7 +44,6 @@ v 7.11.0 (unreleased)
- Add default project and snippet visibility settings to the admin web UI.
- Show incompatible projects in Google Code import status (Stan Hu)
- Fix bug where commit data would not appear in some subdirectories (Stan Hu)
- - Unescape branch names in compare commit (Stan Hu)
- Task lists are now usable in comments, and will show up in Markdown previews.
- Fix bug where avatar filenames were not actually deleted from the database during removal (Stan Hu)
- Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu)
@@ -75,6 +72,15 @@ v 7.11.0 (unreleased)
- Fix reference links in dashboard activity and ATOM feeds.
- Ensure that the first added admin performs repository imports
+v 7.10.4
+ - Fix migrations broken in 7.10.2
+ - Make tags for GitLab installations running on MySQL case sensitive
+ - Get Gitorious importer to work again.
+ - Fix adding new group members from admin area
+ - Fix DB error when trying to tag a repository (Stan Hu)
+ - Fix Error 500 when searching Wiki pages (Stan Hu)
+ - Unescape branch names in compare commit (Stan Hu)
+
v 7.10.2
- Fix CI links on MR page
diff --git a/Gemfile b/Gemfile
index 6de516a11f5..c47a947cab0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -94,7 +94,7 @@ gem "seed-fu"
# Markdown and HTML processing
gem 'html-pipeline', '~> 1.11.0'
-gem 'task_list', '~> 1.0.0', require: 'task_list/railtie'
+gem 'task_list', '1.0.2', require: 'task_list/railtie'
gem 'github-markup'
gem 'redcarpet', '~> 3.2.3'
gem 'RedCloth'
diff --git a/Gemfile.lock b/Gemfile.lock
index 586036923f3..529131f09b0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -338,7 +338,7 @@ GEM
method_source (0.8.2)
mime-types (1.25.1)
mimemagic (0.3.0)
- mini_portile (0.6.1)
+ mini_portile (0.6.2)
minitest (5.3.5)
mousetrap-rails (1.4.6)
multi_json (1.10.1)
@@ -350,7 +350,7 @@ GEM
net-ssh (>= 2.6.5)
net-ssh (2.8.0)
newrelic_rpm (3.9.4.245)
- nokogiri (1.6.5)
+ nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nprogress-rails (0.1.2.3)
oauth (0.4.7)
@@ -802,7 +802,7 @@ DEPENDENCIES
spring-commands-spinach (= 1.0.0)
stamp
state_machine
- task_list (~> 1.0.0)
+ task_list (= 1.0.2)
test_after_commit
thin
tinder (~> 1.9.2)
diff --git a/app/assets/stylesheets/generic/forms.scss b/app/assets/stylesheets/generic/forms.scss
index 266041403e0..7e070b4f386 100644
--- a/app/assets/stylesheets/generic/forms.scss
+++ b/app/assets/stylesheets/generic/forms.scss
@@ -89,7 +89,6 @@ label {
@include box-shadow(none);
}
-.issuable-description,
.wiki-content {
margin-top: 35px;
}
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index e943be67dbf..42b8ecabb38 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -79,11 +79,11 @@ ul.notes {
word-wrap: break-word;
@include md-typography;
- // Reduce left padding of first ul element
+ // Reduce left padding of first task list ul element
ul.task-list:first-child {
padding-left: 10px;
- // sub-lists should be padded normally
+ // sub-tasks should be padded normally
ul {
padding-left: 20px;
}
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb
index 885ac5f85b8..9fe5f82f02f 100644
--- a/app/helpers/blob_helper.rb
+++ b/app/helpers/blob_helper.rb
@@ -9,11 +9,13 @@ module BlobHelper
begin
lexer = Rugments::Lexer.guess(filename: blob_name, source: blob_content)
- rescue Rugments::Lexer::AmbiguousGuess
+ result = formatter.format(lexer.lex(blob_content)).html_safe
+ rescue
lexer = Rugments::Lexers::PlainText
+ result = formatter.format(lexer.lex(blob_content)).html_safe
end
- formatter.format(lexer.lex(blob_content)).html_safe
+ result
end
def no_highlight_files
diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml
index e321a84974e..5a19e980b64 100644
--- a/app/views/projects/_issuable_form.html.haml
+++ b/app/views/projects/_issuable_form.html.haml
@@ -11,6 +11,15 @@
.col-sm-10
= f.text_field :title, maxlength: 255, autofocus: true,
class: 'form-control pad js-gfm-input', required: true
+
+ - if issuable.is_a?(MergeRequest)
+ %p.help-block
+ - if issuable.work_in_progress?
+ This merge request is marked a <strong>Work In Progress</strong>.
+ When it's ready, remove the <code>WIP</code> prefix from the title to allow it to be accepted.
+ - else
+ To prevent this merge request from being accepted before it's ready,
+ mark it a <strong>Work In Progress</strong> by starting the title with <code>[WIP]</code> or <code>WIP:</code>.
.form-group.issuable-description
= f.label :description, 'Description', class: 'control-label'
.col-sm-10
diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml
index cb536214c69..882b219f6e2 100644
--- a/app/views/projects/merge_requests/show/_mr_accept.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml
@@ -6,7 +6,7 @@
.automerge_widget.cannot_be_merged.hide
%strong This request can't be merged automatically. Even if it could be merged, you don't have permission to do so.
.automerge_widget.work_in_progress.hide
- %strong This request can't be merged automatically because it is marked a Work In Progress. Even if it could be merged, you don't have permission to do so.
+ %strong This request can't be accepted because it is marked a Work In Progress. Even if it could be accepted, you don't have permission to do so.
.automerge_widget.can_be_merged.hide
%strong This request can be merged automatically, but you don't have permission to do so.
@@ -57,11 +57,11 @@
%i.fa.fa-warning
Accept Merge Request
&nbsp;
- This usually happens when git can not resolve conflicts between branches automatically.
+ This usually happens when Git can not resolve conflicts between branches automatically.
.automerge_widget.work_in_progress.hide
%h4
- This request can't be merged because it is marked a <strong>Work In Progress</strong>.
+ This request can't be accepted because it is marked a <strong>Work In Progress</strong>.
%p
%button.btn.disabled{:type => 'button'}
@@ -69,7 +69,7 @@
Accept Merge Request
&nbsp;
- When the merge request is ready, remove the "WIP" prefix from the title to allow it to be merged.
+ When the merge request is ready, remove the "WIP" prefix from the title to allow it to be accepted.
.automerge_widget.unchecked
%p
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index 133010adcaf..c0fb22e7f36 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -1,5 +1,4 @@
require 'html/pipeline'
-require 'task_list/filter'
module Gitlab
# Custom parser for GitLab-flavored Markdown
@@ -19,6 +18,7 @@ module Gitlab
autoload :SanitizationFilter, 'gitlab/markdown/sanitization_filter'
autoload :SnippetReferenceFilter, 'gitlab/markdown/snippet_reference_filter'
autoload :TableOfContentsFilter, 'gitlab/markdown/table_of_contents_filter'
+ autoload :TaskListFilter, 'gitlab/markdown/task_list_filter'
autoload :UserReferenceFilter, 'gitlab/markdown/user_reference_filter'
# Public: Parse the provided text with GitLab-Flavored Markdown
@@ -113,7 +113,7 @@ module Gitlab
Gitlab::Markdown::CommitReferenceFilter,
Gitlab::Markdown::LabelReferenceFilter,
- TaskList::Filter
+ Gitlab::Markdown::TaskListFilter
]
end
end
diff --git a/lib/gitlab/markdown/sanitization_filter.rb b/lib/gitlab/markdown/sanitization_filter.rb
index 6f33155badf..88781fea0c8 100644
--- a/lib/gitlab/markdown/sanitization_filter.rb
+++ b/lib/gitlab/markdown/sanitization_filter.rb
@@ -8,28 +8,33 @@ module Gitlab
# Extends HTML::Pipeline::SanitizationFilter with a custom whitelist.
class SanitizationFilter < HTML::Pipeline::SanitizationFilter
def whitelist
- whitelist = HTML::Pipeline::SanitizationFilter::WHITELIST
+ whitelist = super
- # Allow code highlighting
- whitelist[:attributes]['pre'] = %w(class)
- whitelist[:attributes]['span'] = %w(class)
+ # Only push these customizations once
+ unless customized?(whitelist[:transformers])
+ # Allow code highlighting
+ whitelist[:attributes]['pre'] = %w(class)
+ whitelist[:attributes]['span'] = %w(class)
- # Allow table alignment
- whitelist[:attributes]['th'] = %w(style)
- whitelist[:attributes]['td'] = %w(style)
+ # Allow table alignment
+ whitelist[:attributes]['th'] = %w(style)
+ whitelist[:attributes]['td'] = %w(style)
- # Allow span elements
- whitelist[:elements].push('span')
+ # Allow span elements
+ whitelist[:elements].push('span')
- # Remove `rel` attribute from `a` elements
- whitelist[:transformers].push(remove_rel)
+ # Remove `rel` attribute from `a` elements
+ whitelist[:transformers].push(remove_rel)
- # Remove `class` attribute from non-highlight spans
- whitelist[:transformers].push(clean_spans)
+ # Remove `class` attribute from non-highlight spans
+ whitelist[:transformers].push(clean_spans)
+ end
whitelist
end
+ private
+
def remove_rel
lambda do |env|
if env[:node_name] == 'a'
@@ -48,6 +53,10 @@ module Gitlab
end
end
end
+
+ def customized?(transformers)
+ transformers.last.source_location[0] == __FILE__
+ end
end
end
end
diff --git a/lib/gitlab/markdown/task_list_filter.rb b/lib/gitlab/markdown/task_list_filter.rb
new file mode 100644
index 00000000000..c6eb2e2bf6d
--- /dev/null
+++ b/lib/gitlab/markdown/task_list_filter.rb
@@ -0,0 +1,23 @@
+require 'task_list/filter'
+
+module Gitlab
+ module Markdown
+ # Work around a bug in the default TaskList::Filter that adds a `task-list`
+ # class to every list element, regardless of whether or not it contains a
+ # task list.
+ #
+ # This is a (hopefully) temporary fix, pending a new release of the
+ # task_list gem.
+ #
+ # See https://github.com/github/task_list/pull/60
+ class TaskListFilter < TaskList::Filter
+ def add_css_class(node, *new_class_names)
+ if new_class_names.include?('task-list')
+ super if node.children.any? { |c| c['class'] == 'task-list-item' }
+ else
+ super
+ end
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/markdown/task_list_filter_spec.rb b/spec/lib/gitlab/markdown/task_list_filter_spec.rb
new file mode 100644
index 00000000000..2a1e1cc5127
--- /dev/null
+++ b/spec/lib/gitlab/markdown/task_list_filter_spec.rb
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+module Gitlab::Markdown
+ describe TaskListFilter do
+ def filter(html, options = {})
+ described_class.call(html, options)
+ end
+
+ it 'does not apply `task-list` class to non-task lists' do
+ exp = act = %(<ul><li>Item</li></ul>)
+ expect(filter(act).to_html).to eq exp
+ end
+ end
+end