diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2017-06-28 01:54:35 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2017-06-28 01:54:35 +0000 |
commit | 8d890d71d58d37cf87c41ee6808a55a7f784e8a8 (patch) | |
tree | a787e783f982db882206076f9971cbf8dc79329c | |
parent | b2dd17b2f2c0d02c18d5b413d5fefd59b4c9fed1 (diff) | |
parent | a1f0692d682cd304f2d8b7d0f523921853409402 (diff) | |
download | gitlab-ce-8d890d71d58d37cf87c41ee6808a55a7f784e8a8.tar.gz |
Merge branch '9-3-stable-patch-2' into '9-3-stable'
Prepare 9.3.2
See merge request !12493
29 files changed, 124 insertions, 39 deletions
@@ -255,7 +255,7 @@ gem 'base32', '~> 0.3.0' # Sentry integration gem 'sentry-raven', '~> 2.4.0' -gem 'premailer-rails', '~> 1.9.0' +gem 'premailer-rails', '~> 1.9.7' # I18n gem 'ruby_parser', '~> 3.8.4', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 83f6961e785..0de8746109e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -136,7 +136,7 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) creole (0.5.0) - css_parser (1.4.1) + css_parser (1.5.0) addressable d3_rails (3.5.11) railties (>= 3.1.0) @@ -460,7 +460,7 @@ GEM mimemagic (0.3.0) mini_portile2 (2.1.0) minitest (5.7.0) - mmap2 (2.2.6) + mmap2 (2.2.7) mousetrap-rails (1.4.6) multi_json (1.12.1) multi_xml (0.6.0) @@ -588,10 +588,11 @@ GEM websocket-driver (>= 0.2.0) posix-spawn (0.3.11) powerpack (0.1.1) - premailer (1.8.6) - css_parser (>= 1.3.6) + premailer (1.10.4) + addressable + css_parser (>= 1.4.10) htmlentities (>= 4.0.0) - premailer-rails (1.9.2) + premailer-rails (1.9.7) actionmailer (>= 3, < 6) premailer (~> 1.7, >= 1.7.9) prometheus-client-mmap (0.7.0.beta5) @@ -1039,7 +1040,7 @@ DEPENDENCIES peek-sidekiq (~> 1.0.3) pg (~> 0.18.2) poltergeist (~> 1.9.0) - premailer-rails (~> 1.9.0) + premailer-rails (~> 1.9.7) prometheus-client-mmap (~> 0.7.0.beta5) pry-byebug (~> 3.4.1) pry-rails (~> 0.3.4) diff --git a/app/assets/javascripts/behaviors/quick_submit.js b/app/assets/javascripts/behaviors/quick_submit.js index 1f9e0448084..bc693616460 100644 --- a/app/assets/javascripts/behaviors/quick_submit.js +++ b/app/assets/javascripts/behaviors/quick_submit.js @@ -40,7 +40,7 @@ $(document).on('keydown.quick_submit', '.js-quick-submit', (e) => { e.preventDefault(); const $form = $(e.target).closest('form'); - const $submitButton = $form.find('input[type=submit], button[type=submit]'); + const $submitButton = $form.find('input[type=submit], button[type=submit]').first(); if (!$submitButton.attr('disabled')) { $submitButton.trigger('click', [e]); diff --git a/app/assets/javascripts/label_manager.js b/app/assets/javascripts/label_manager.js index 38b2eb9ff14..d8814802d9e 100644 --- a/app/assets/javascripts/label_manager.js +++ b/app/assets/javascripts/label_manager.js @@ -21,6 +21,7 @@ } bindEvents() { + this.prioritizedLabels.find('.btn-action').on('mousedown', this, this.onButtonActionClick); return this.togglePriorityButton.on('click', this, this.onTogglePriorityClick); } @@ -36,6 +37,11 @@ _this.toggleEmptyState($label, $btn, action); } + onButtonActionClick(e) { + e.stopPropagation(); + $(e.currentTarget).tooltip('hide'); + } + toggleEmptyState($label, $btn, action) { this.emptyState.classList.toggle('hidden', !!this.prioritizedLabels[0].querySelector(':scope > li')); } diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index d08df05fd6c..78f425057eb 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -85,7 +85,7 @@ } /** - * Annotate file + * Blame file */ &.blame { table { diff --git a/app/assets/stylesheets/pages/labels.scss b/app/assets/stylesheets/pages/labels.scss index c10588ac58e..b158416b940 100644 --- a/app/assets/stylesheets/pages/labels.scss +++ b/app/assets/stylesheets/pages/labels.scss @@ -138,6 +138,7 @@ .fa { font-size: 18px; vertical-align: middle; + pointer-events: none; } &:hover { diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index f0dbe4249c5..53d5cf2f7bc 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -473,7 +473,7 @@ ul.notes { } .more-actions { - display: inline; + display: inline-block; .tooltip { white-space: nowrap; diff --git a/app/models/project.rb b/app/models/project.rb index e1ee22b1a82..4b289d15ae7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -704,7 +704,7 @@ class Project < ActiveRecord::Base end def last_activity_date - last_activity_at || updated_at + last_repository_updated_at || last_activity_at || updated_at end def project_id diff --git a/app/models/project_services/prometheus_service.rb b/app/models/project_services/prometheus_service.rb index 110b8bc209b..3e95cbe7a68 100644 --- a/app/models/project_services/prometheus_service.rb +++ b/app/models/project_services/prometheus_service.rb @@ -70,7 +70,7 @@ class PrometheusService < MonitoringService def deployment_metrics(deployment) metrics = with_reactive_cache(Gitlab::Prometheus::Queries::DeploymentQuery.name, deployment.id, &:itself) - metrics&.merge(deployment_time: created_at.to_i) || {} + metrics&.merge(deployment_time: deployment.created_at.to_i) || {} end # Cache metrics for specific environment diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index a6ee2b2f7b8..a2ec3d44185 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -1,5 +1,5 @@ - @no_container = true -- page_title "Annotate", @blob.path, @ref +- page_title "Blame", @blob.path, @ref = render "projects/commits/head" %div{ class: container_class } diff --git a/app/views/projects/blob/_breadcrumb.html.haml b/app/views/projects/blob/_breadcrumb.html.haml index 0ad9f258e48..3f58e8d232f 100644 --- a/app/views/projects/blob/_breadcrumb.html.haml +++ b/app/views/projects/blob/_breadcrumb.html.haml @@ -10,7 +10,7 @@ = link_to 'Normal view', namespace_project_blob_path(@project.namespace, @project, @id), class: 'btn' - else - = link_to 'Annotate', namespace_project_blame_path(@project.namespace, @project, @id), + = link_to 'Blame', namespace_project_blame_path(@project.namespace, @project, @id), class: 'btn js-blob-blame-link' unless blob.empty? = link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), diff --git a/app/views/projects/deployments/_deployment.html.haml b/app/views/projects/deployments/_deployment.html.haml index b3052bf7c35..e470c3c44ff 100644 --- a/app/views/projects/deployments/_deployment.html.haml +++ b/app/views/projects/deployments/_deployment.html.haml @@ -11,11 +11,14 @@ .table-mobile-header{ role: 'rowheader' } Job - if deployment.deployable .table-mobile-content - = link_to [@project.namespace.becomes(Namespace), @project, deployment.deployable], class: 'build-link' do - #{deployment.deployable.name} (##{deployment.deployable.id}) + .flex-truncate-parent + .flex-truncate-child + = link_to [@project.namespace.becomes(Namespace), @project, deployment.deployable], class: 'build-link' do + #{deployment.deployable.name} (##{deployment.deployable.id}) - if deployment.user - by - = user_avatar(user: deployment.user, size: 20) + %div + by + = user_avatar(user: deployment.user, size: 20) .table-section.section-15{ role: 'gridcell' } .table-mobile-header{ role: 'rowheader' } Created diff --git a/app/views/projects/environments/show.html.haml b/app/views/projects/environments/show.html.haml index 23aa4c29e69..31e2bb11ce8 100644 --- a/app/views/projects/environments/show.html.haml +++ b/app/views/projects/environments/show.html.haml @@ -31,8 +31,8 @@ .ci-table.environments{ role: 'grid' } .gl-responsive-table-row.table-row-header{ role: 'row' } .table-section.section-10{ role: 'columnheader' } ID - .table-section.section-40{ role: 'columnheader' } Commit - .table-section.section-15{ role: 'columnheader' } Job + .table-section.section-30{ role: 'columnheader' } Commit + .table-section.section-25{ role: 'columnheader' } Job .table-section.section-15{ role: 'columnheader' } Created = render @deployments diff --git a/app/views/shared/_label.html.haml b/app/views/shared/_label.html.haml index c185e9b73ee..3f48dbca18a 100644 --- a/app/views/shared/_label.html.haml +++ b/app/views/shared/_label.html.haml @@ -6,7 +6,7 @@ = render "shared/label_row", label: label .visible-xs.visible-sm-inline-block.visible-md-inline-block.dropdown - %button.btn.btn-default.label-options-toggle{ data: { toggle: "dropdown" } } + %button.btn.btn-default.label-options-toggle{ type: 'button', data: { toggle: "dropdown" } } Options = icon('caret-down') .dropdown-menu.dropdown-menu-align-right diff --git a/app/views/shared/_label_row.html.haml b/app/views/shared/_label_row.html.haml index d28f9421ecf..7b599dff0e3 100644 --- a/app/views/shared/_label_row.html.haml +++ b/app/views/shared/_label_row.html.haml @@ -4,9 +4,9 @@ = icon('bars') .js-toggle-priority.toggle-priority{ data: { url: remove_priority_namespace_project_label_path(@project.namespace, @project, label), dom_id: dom_id(label), type: label.type } } - %button.add-priority.btn.has-tooltip{ title: 'Prioritize', :'data-placement' => 'top' } + %button.add-priority.btn.has-tooltip{ title: 'Prioritize', type: 'button', :'data-placement' => 'top' } = icon('star-o') - %button.remove-priority.btn.has-tooltip{ title: 'Remove priority', :'data-placement' => 'top' } + %button.remove-priority.btn.has-tooltip{ title: 'Remove priority', type: 'button', :'data-placement' => 'top' } = icon('star') %span.label-name = link_to_label(label, subject: @project, tooltip: false) diff --git a/app/views/shared/projects/_project.html.haml b/app/views/shared/projects/_project.html.haml index fbc335f6176..8c3d6351ac2 100644 --- a/app/views/shared/projects/_project.html.haml +++ b/app/views/shared/projects/_project.html.haml @@ -7,7 +7,7 @@ - show_last_commit_as_description = false unless local_assigns[:show_last_commit_as_description] == true && project.commit - css_class += " no-description" if project.description.blank? && !show_last_commit_as_description - cache_key = project_list_cache_key(project) -- updated_tooltip = time_ago_with_tooltip(project.last_activity_at) +- updated_tooltip = time_ago_with_tooltip(project.last_activity_date) %li.project-row{ class: css_class } = cache(cache_key) do diff --git a/changelogs/unreleased/34282-fix-api-using-include_missing-false.yml b/changelogs/unreleased/34282-fix-api-using-include_missing-false.yml new file mode 100644 index 00000000000..e7fff2c1a9f --- /dev/null +++ b/changelogs/unreleased/34282-fix-api-using-include_missing-false.yml @@ -0,0 +1,4 @@ +--- +title: 'API: Fix optional arugments for POST :id/variables' +merge_request: 12474 +author: diff --git a/changelogs/unreleased/sh-fix-premailer-gem-for-filesystem.yml b/changelogs/unreleased/sh-fix-premailer-gem-for-filesystem.yml new file mode 100644 index 00000000000..9e3c3e19bea --- /dev/null +++ b/changelogs/unreleased/sh-fix-premailer-gem-for-filesystem.yml @@ -0,0 +1,5 @@ +--- +title: Bump premailer-rails gem to 1.9.7 and its dependencies to prevent network retrieval + of assets +merge_request: +author: diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 80aa3a047a0..9ed4f8ea1f9 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -369,7 +369,6 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps expect(page).to have_content 'Permalink' expect(page).not_to have_content 'Edit' expect(page).not_to have_content 'Blame' - expect(page).not_to have_content 'Annotate' expect(page).to have_content 'Delete' expect(page).to have_content 'Replace' end diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 381c4ef50b0..10374995497 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -45,7 +45,7 @@ module API optional :protected, type: String, desc: 'Whether the variable is protected' end post ':id/variables' do - variable = user_project.variables.create(declared(params, include_parent_namespaces: false).to_h) + variable = user_project.variables.create(declared_params(include_missing: false)) if variable.valid? present variable, with: Entities::Variable diff --git a/lib/system_check/simple_executor.rb b/lib/system_check/simple_executor.rb index dc2d4643a01..e5986612908 100644 --- a/lib/system_check/simple_executor.rb +++ b/lib/system_check/simple_executor.rb @@ -75,6 +75,8 @@ module SystemCheck check.show_error end + rescue StandardError => e + $stdout.puts "Exception: #{e.message}".color(:red) end private diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 3568954a548..943597a4e35 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -15,13 +15,25 @@ RSpec.describe 'Dashboard Projects', feature: true do expect(page).to have_content('awesome stuff') end - it 'shows the last_activity_at attribute as the update date' do - now = Time.now - project.update_column(:last_activity_at, now) + context 'when last_repository_updated_at, last_activity_at and update_at are present' do + it 'shows the last_repository_updated_at attribute as the update date' do + project.update_attributes!(last_repository_updated_at: Time.now, last_activity_at: 1.hour.ago) - visit dashboard_projects_path + visit dashboard_projects_path + + expect(page).to have_xpath("//time[@datetime='#{project.last_repository_updated_at.getutc.iso8601}']") + end + end - expect(page).to have_xpath("//time[@datetime='#{now.getutc.iso8601}']") + context 'when last_repository_updated_at and last_activity_at are missing' do + it 'shows the updated_at attribute as the update date' do + project.update_attributes!(last_repository_updated_at: nil, last_activity_at: nil) + project.touch + + visit dashboard_projects_path + + expect(page).to have_xpath("//time[@datetime='#{project.updated_at.getutc.iso8601}']") + end end context 'when on Starred projects tab' do diff --git a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb index 53c5a52ce3a..d94204230f6 100644 --- a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb +++ b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb @@ -55,7 +55,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, end end - describe 'Click "Annotate" button' do + describe 'Click "Blame" button' do it 'works with no initial line number fragment hash' do visit_blob diff --git a/spec/features/projects/files/browse_files_spec.rb b/spec/features/projects/files/browse_files_spec.rb index 30a1eedbb48..c0a9327249c 100644 --- a/spec/features/projects/files/browse_files_spec.rb +++ b/spec/features/projects/files/browse_files_spec.rb @@ -12,7 +12,7 @@ feature 'user browses project', feature: true, js: true do scenario "can see blame of '.gitignore'" do click_link ".gitignore" - click_link 'Annotate' + click_link 'Blame' expect(page).to have_content "*.rb" expect(page).to have_content "Dmitriy Zaporozhets" diff --git a/spec/features/snippets/notes_on_personal_snippets_spec.rb b/spec/features/snippets/notes_on_personal_snippets_spec.rb index 04b596d29a1..d088739b5fc 100644 --- a/spec/features/snippets/notes_on_personal_snippets_spec.rb +++ b/spec/features/snippets/notes_on_personal_snippets_spec.rb @@ -33,6 +33,7 @@ describe 'Comments on personal snippets', :js, feature: true do expect(page).to have_selector('.note-emoji-button') end + find('body').click # close dropdown open_more_actions_dropdown(snippet_notes[1]) page.within("#notes-list li#note_#{snippet_notes[1].id}") do diff --git a/spec/javascripts/behaviors/quick_submit_spec.js b/spec/javascripts/behaviors/quick_submit_spec.js index f56b99f8a16..6dc48f9a293 100644 --- a/spec/javascripts/behaviors/quick_submit_spec.js +++ b/spec/javascripts/behaviors/quick_submit_spec.js @@ -40,16 +40,29 @@ import '~/behaviors/quick_submit'; it('disables input of type submit', function() { const submitButton = $('.js-quick-submit input[type=submit]'); this.textarea.trigger(keydownEvent()); + expect(submitButton).toBeDisabled(); }); it('disables button of type submit', function() { - // button doesn't exist in fixture, add it manually - const submitButton = $('<button type="submit">Submit it</button>'); - submitButton.insertAfter(this.textarea); - + const submitButton = $('.js-quick-submit input[type=submit]'); this.textarea.trigger(keydownEvent()); + expect(submitButton).toBeDisabled(); }); + it('only clicks one submit', function() { + const existingSubmit = $('.js-quick-submit input[type=submit]'); + // Add an extra submit button + const newSubmit = $('<button type="submit">Submit it</button>'); + newSubmit.insertAfter(this.textarea); + + const oldClick = spyOnEvent(existingSubmit, 'click'); + const newClick = spyOnEvent(newSubmit, 'click'); + + this.textarea.trigger(keydownEvent()); + + expect(oldClick).not.toHaveBeenTriggered(); + expect(newClick).toHaveBeenTriggered(); + }); // We cannot stub `navigator.userAgent` for CI's `rake karma` task, so we'll // only run the tests that apply to the current platform if (navigator.userAgent.match(/Macintosh/)) { diff --git a/spec/lib/system_check/simple_executor_spec.rb b/spec/lib/system_check/simple_executor_spec.rb index a5c6170cd7d..795f11ee1f8 100644 --- a/spec/lib/system_check/simple_executor_spec.rb +++ b/spec/lib/system_check/simple_executor_spec.rb @@ -75,6 +75,24 @@ describe SystemCheck::SimpleExecutor, lib: true do end end + class BugousCheck < SystemCheck::BaseCheck + CustomError = Class.new(StandardError) + set_name 'my bugous check' + + def check? + raise CustomError, 'omg' + end + end + + before do + @rainbow = Rainbow.enabled + Rainbow.enabled = false + end + + after do + Rainbow.enabled = @rainbow + end + describe '#component' do it 'returns stored component name' do expect(subject.component).to eq('Test') @@ -219,5 +237,11 @@ describe SystemCheck::SimpleExecutor, lib: true do end end end + + context 'when there is an exception' do + it 'rescues the exception' do + expect{ subject.run_check(BugousCheck) }.not_to raise_exception + end + end end end diff --git a/spec/models/project_services/prometheus_service_spec.rb b/spec/models/project_services/prometheus_service_spec.rb index 1f9d3c07b51..d341296336d 100644 --- a/spec/models/project_services/prometheus_service_spec.rb +++ b/spec/models/project_services/prometheus_service_spec.rb @@ -67,7 +67,7 @@ describe PrometheusService, models: true, caching: true do end describe '#deployment_metrics' do - let(:deployment) { build_stubbed(:deployment)} + let(:deployment) { build_stubbed(:deployment) } let(:deployment_query) { Gitlab::Prometheus::Queries::DeploymentQuery } around do |example| @@ -76,13 +76,16 @@ describe PrometheusService, models: true, caching: true do context 'with valid data' do subject { service.deployment_metrics(deployment) } + let(:fake_deployment_time) { 10 } before do stub_reactive_cache(service, prometheus_data, deployment_query, deployment.id) end it 'returns reactive data' do - is_expected.to eq(prometheus_data.merge(deployment_time: deployment.created_at.to_i)) + expect(deployment).to receive(:created_at).and_return(fake_deployment_time) + + expect(subject).to eq(prometheus_data.merge(deployment_time: fake_deployment_time)) end end end diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb index 83673864fe7..e0975024b80 100644 --- a/spec/requests/api/variables_spec.rb +++ b/spec/requests/api/variables_spec.rb @@ -82,6 +82,17 @@ describe API::Variables do expect(json_response['protected']).to be_truthy end + it 'creates variable with optional attributes' do + expect do + post api("/projects/#{project.id}/variables", user), key: 'TEST_VARIABLE_2', value: 'VALUE_2' + end.to change{project.variables.count}.by(1) + + expect(response).to have_http_status(201) + expect(json_response['key']).to eq('TEST_VARIABLE_2') + expect(json_response['value']).to eq('VALUE_2') + expect(json_response['protected']).to be_falsey + end + it 'does not allow to duplicate variable key' do expect do post api("/projects/#{project.id}/variables", user), key: variable.key, value: 'VALUE_2' |