diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2017-10-20 17:17:03 +0000 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2017-10-20 17:17:03 +0000 |
commit | bb1f4e383b77c336881e853550b22838bbfd0c88 (patch) | |
tree | 4cf743ee9ebb8b11864a94646ece82f37e9b4ab1 | |
parent | 1652288f65547e352f50312d2457dffd20db423c (diff) | |
parent | 8b744b21f3725eb6772f8750c8b76d4593215f04 (diff) | |
download | gitlab-ce-bb1f4e383b77c336881e853550b22838bbfd0c88.tar.gz |
Merge branch '10-1-stable-prepare-rc4' into '10-1-stable'
Prepare 10.1 RC4 release
See merge request gitlab-org/gitlab-ce!14953
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | app/assets/javascripts/registry/components/collapsible_container.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/registry/components/table_registry.vue | 2 | ||||
-rw-r--r-- | app/serializers/container_tag_entity.rb | 2 | ||||
-rw-r--r-- | app/views/discussions/_discussion.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/fix-non-diff-resolved-discussion.yml | 5 | ||||
-rw-r--r-- | config/routes/project.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/encoding_helper.rb | 7 | ||||
-rw-r--r-- | spec/lib/gitlab/encoding_helper_spec.rb | 16 | ||||
-rw-r--r-- | spec/support/features/discussion_comments_shared_example.rb | 29 |
11 files changed, 61 insertions, 19 deletions
@@ -281,7 +281,7 @@ group :metrics do gem 'influxdb', '~> 0.2', require: false # Prometheus - gem 'prometheus-client-mmap', '~>0.7.0.beta14' + gem 'prometheus-client-mmap', '~>0.7.0.beta17' gem 'raindrops', '~> 0.18' end diff --git a/Gemfile.lock b/Gemfile.lock index 6040596dda5..8dc206c46a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -620,7 +620,7 @@ GEM parser unparser procto (0.0.3) - prometheus-client-mmap (0.7.0.beta14) + prometheus-client-mmap (0.7.0.beta17) mmap2 (~> 2.2, >= 2.2.7) pry (0.10.4) coderay (~> 1.1.0) @@ -1103,7 +1103,7 @@ DEPENDENCIES pg (~> 0.18.2) poltergeist (~> 1.9.0) premailer-rails (~> 1.9.7) - prometheus-client-mmap (~> 0.7.0.beta14) + prometheus-client-mmap (~> 0.7.0.beta17) pry-byebug (~> 3.4.1) pry-rails (~> 0.3.4) rack-attack (~> 4.4.1) diff --git a/app/assets/javascripts/registry/components/collapsible_container.vue b/app/assets/javascripts/registry/components/collapsible_container.vue index 41ea9742406..ac1c3ec253c 100644 --- a/app/assets/javascripts/registry/components/collapsible_container.vue +++ b/app/assets/javascripts/registry/components/collapsible_container.vue @@ -57,7 +57,7 @@ }, showError(message) { - Flash((errorMessages[message])); + Flash(errorMessages[message]); }, }, }; diff --git a/app/assets/javascripts/registry/components/table_registry.vue b/app/assets/javascripts/registry/components/table_registry.vue index 4ce1571b0aa..e917279947e 100644 --- a/app/assets/javascripts/registry/components/table_registry.vue +++ b/app/assets/javascripts/registry/components/table_registry.vue @@ -57,7 +57,7 @@ }, showError(message) { - Flash((errorMessages[message])); + Flash(errorMessages[message]); }, }, }; diff --git a/app/serializers/container_tag_entity.rb b/app/serializers/container_tag_entity.rb index 26a68c43807..8f1488e6cbb 100644 --- a/app/serializers/container_tag_entity.rb +++ b/app/serializers/container_tag_entity.rb @@ -4,7 +4,7 @@ class ContainerTagEntity < Grape::Entity expose :name, :location, :revision, :short_revision, :total_size, :created_at expose :destroy_path, if: -> (*) { can_destroy? } do |tag| - project_registry_repository_tag_path(project, tag.repository, tag.name, format: :json) + project_registry_repository_tag_path(project, tag.repository, tag.name) end private diff --git a/app/views/discussions/_discussion.html.haml b/app/views/discussions/_discussion.html.haml index 578e751ab47..0f03163a2e8 100644 --- a/app/views/discussions/_discussion.html.haml +++ b/app/views/discussions/_discussion.html.haml @@ -44,4 +44,4 @@ = render "discussions/diff_with_notes", discussion: discussion - else .panel.panel-default - = render "discussions/notes", discussion: discussion + = render partial: "discussions/notes", locals: { discussion: discussion, disable_collapse_class: true } diff --git a/changelogs/unreleased/fix-non-diff-resolved-discussion.yml b/changelogs/unreleased/fix-non-diff-resolved-discussion.yml new file mode 100644 index 00000000000..9bff53ea7c9 --- /dev/null +++ b/changelogs/unreleased/fix-non-diff-resolved-discussion.yml @@ -0,0 +1,5 @@ +--- +title: Force non diff resolved discussion to display when collapse toggled +merge_request: +author: +type: fixed diff --git a/config/routes/project.rb b/config/routes/project.rb index 7f0e056c884..d05fe11f233 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -281,8 +281,13 @@ constraints(ProjectUrlConstrainer.new) do namespace :registry do resources :repository, only: [] do - resources :tags, only: [:index, :destroy], - constraints: { id: Gitlab::Regex.container_registry_tag_regex } + # We default to JSON format in the controller to avoid ambiguity. + # `latest.json` could either be a request for a tag named `latest` + # in JSON format, or a request for tag named `latest.json`. + scope format: false do + resources :tags, only: [:index, :destroy], + constraints: { id: Gitlab::Regex.container_registry_tag_regex } + end end end diff --git a/lib/gitlab/encoding_helper.rb b/lib/gitlab/encoding_helper.rb index 7b3483a7f96..99dfee3dd9b 100644 --- a/lib/gitlab/encoding_helper.rb +++ b/lib/gitlab/encoding_helper.rb @@ -14,9 +14,9 @@ module Gitlab ENCODING_CONFIDENCE_THRESHOLD = 50 def encode!(message) - return nil unless message.respond_to? :force_encoding + return nil unless message.respond_to?(:force_encoding) + return message if message.encoding == Encoding::UTF_8 && message.valid_encoding? - # if message is utf-8 encoding, just return it message.force_encoding("UTF-8") return message if message.valid_encoding? @@ -50,6 +50,9 @@ module Gitlab end def encode_utf8(message) + return nil unless message.is_a?(String) + return message if message.encoding == Encoding::UTF_8 && message.valid_encoding? + detect = CharlockHolmes::EncodingDetector.detect(message) if detect && detect[:encoding] begin diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index 8b14b227e65..9151c66afb3 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -6,6 +6,9 @@ describe Gitlab::EncodingHelper do describe '#encode!' do [ + ["nil", nil, nil], + ["empty string", "".encode("ASCII-8BIT"), "".encode("UTF-8")], + ["invalid utf-8 encoded string", "my bad string\xE5".force_encoding("UTF-8"), "my bad string"], [ 'leaves ascii only string as is', 'ascii only string', @@ -81,6 +84,9 @@ describe Gitlab::EncodingHelper do describe '#encode_utf8' do [ + ["nil", nil, nil], + ["empty string", "".encode("ASCII-8BIT"), "".encode("UTF-8")], + ["invalid utf-8 encoded string", "my bad string\xE5".force_encoding("UTF-8"), "my bad stringå"], [ "encodes valid utf8 encoded string to utf8", "λ, λ, λ".encode("UTF-8"), @@ -95,12 +101,18 @@ describe Gitlab::EncodingHelper do "encodes valid ISO-8859-1 encoded string to utf8", "Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.".encode("ISO-8859-1", "UTF-8"), "Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.".encode("UTF-8") + ], + [ + # Test case from https://gitlab.com/gitlab-org/gitlab-ce/issues/39227 + "Equifax branch name", + "refs/heads/Equifax".encode("UTF-8"), + "refs/heads/Equifax".encode("UTF-8") ] ].each do |description, test_string, xpect| it description do - r = ext_class.encode_utf8(test_string.force_encoding('UTF-8')) + r = ext_class.encode_utf8(test_string) expect(r).to eq(xpect) - expect(r.encoding.name).to eq('UTF-8') + expect(r.encoding.name).to eq('UTF-8') if xpect end end diff --git a/spec/support/features/discussion_comments_shared_example.rb b/spec/support/features/discussion_comments_shared_example.rb index 9f05cabf7ae..7132b9cd221 100644 --- a/spec/support/features/discussion_comments_shared_example.rb +++ b/spec/support/features/discussion_comments_shared_example.rb @@ -121,14 +121,31 @@ shared_examples 'discussion comments' do |resource_name| end end - it 'clicking "Start discussion" will post a discussion' do - find(submit_selector).click + describe 'creating a discussion' do + before do + find(submit_selector).click + find(comments_selector, match: :first) + end + + it 'clicking "Start discussion" will post a discussion' do + new_comment = all(comments_selector).last + + expect(new_comment).to have_content 'a' + expect(new_comment).to have_selector '.discussion' + end + + if resource_name == 'merge request' + it 'shows resolved discussion when toggled' do + click_button "Resolve discussion" + + expect(page).to have_selector('.note-row-1', visible: true) - find(comments_selector, match: :first) - new_comment = all(comments_selector).last + refresh + click_button "Toggle discussion" - expect(new_comment).to have_content 'a' - expect(new_comment).to have_selector '.discussion' + expect(page).to have_selector('.note-row-1', visible: true) + end + end end if resource_name == 'issue' |