From 1efa8f2e15664c4268f6357f2a24449c38e5047d Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Wed, 8 Feb 2017 16:42:27 +0100 Subject: Rename issuable to IssueBase Given the the Issuable class will soon also have to support MRs this signals that it can only be used by issues. --- lib/gitlab/chat_commands/presenters/issuable.rb | 43 ---------------------- lib/gitlab/chat_commands/presenters/issue_base.rb | 43 ++++++++++++++++++++++ lib/gitlab/chat_commands/presenters/issue_new.rb | 2 +- .../chat_commands/presenters/issue_search.rb | 2 +- lib/gitlab/chat_commands/presenters/issue_show.rb | 2 +- 5 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 lib/gitlab/chat_commands/presenters/issuable.rb create mode 100644 lib/gitlab/chat_commands/presenters/issue_base.rb diff --git a/lib/gitlab/chat_commands/presenters/issuable.rb b/lib/gitlab/chat_commands/presenters/issuable.rb deleted file mode 100644 index dfb1c8f6616..00000000000 --- a/lib/gitlab/chat_commands/presenters/issuable.rb +++ /dev/null @@ -1,43 +0,0 @@ -module Gitlab - module ChatCommands - module Presenters - module Issuable - def color(issuable) - issuable.open? ? '#38ae67' : '#d22852' - end - - def status_text(issuable) - issuable.open? ? 'Open' : 'Closed' - end - - def project - @resource.project - end - - def author - @resource.author - end - - def fields - [ - { - title: "Assignee", - value: @resource.assignee ? @resource.assignee.name : "_None_", - short: true - }, - { - title: "Milestone", - value: @resource.milestone ? @resource.milestone.title : "_None_", - short: true - }, - { - title: "Labels", - value: @resource.labels.any? ? @resource.label_names : "_None_", - short: true - } - ] - end - end - end - end -end diff --git a/lib/gitlab/chat_commands/presenters/issue_base.rb b/lib/gitlab/chat_commands/presenters/issue_base.rb new file mode 100644 index 00000000000..a0058407fb2 --- /dev/null +++ b/lib/gitlab/chat_commands/presenters/issue_base.rb @@ -0,0 +1,43 @@ +module Gitlab + module ChatCommands + module Presenters + module IssueBase + def color(issuable) + issuable.open? ? '#38ae67' : '#d22852' + end + + def status_text(issuable) + issuable.open? ? 'Open' : 'Closed' + end + + def project + @resource.project + end + + def author + @resource.author + end + + def fields + [ + { + title: "Assignee", + value: @resource.assignee ? @resource.assignee.name : "_None_", + short: true + }, + { + title: "Milestone", + value: @resource.milestone ? @resource.milestone.title : "_None_", + short: true + }, + { + title: "Labels", + value: @resource.labels.any? ? @resource.label_names : "_None_", + short: true + } + ] + end + end + end + end +end diff --git a/lib/gitlab/chat_commands/presenters/issue_new.rb b/lib/gitlab/chat_commands/presenters/issue_new.rb index a1a3add56c9..0d31660039a 100644 --- a/lib/gitlab/chat_commands/presenters/issue_new.rb +++ b/lib/gitlab/chat_commands/presenters/issue_new.rb @@ -2,7 +2,7 @@ module Gitlab module ChatCommands module Presenters class IssueNew < Presenters::Base - include Presenters::Issuable + include Presenters::IssueBase def present in_channel_response(new_issue) diff --git a/lib/gitlab/chat_commands/presenters/issue_search.rb b/lib/gitlab/chat_commands/presenters/issue_search.rb index 3478359b91d..73788cf9662 100644 --- a/lib/gitlab/chat_commands/presenters/issue_search.rb +++ b/lib/gitlab/chat_commands/presenters/issue_search.rb @@ -2,7 +2,7 @@ module Gitlab module ChatCommands module Presenters class IssueSearch < Presenters::Base - include Presenters::Issuable + include Presenters::IssueBase def present text = if @resource.count >= 5 diff --git a/lib/gitlab/chat_commands/presenters/issue_show.rb b/lib/gitlab/chat_commands/presenters/issue_show.rb index fe5847ccd15..bd784ad241e 100644 --- a/lib/gitlab/chat_commands/presenters/issue_show.rb +++ b/lib/gitlab/chat_commands/presenters/issue_show.rb @@ -2,7 +2,7 @@ module Gitlab module ChatCommands module Presenters class IssueShow < Presenters::Base - include Presenters::Issuable + include Presenters::IssueBase def present if @resource.confidential? -- cgit v1.2.1 From 744df2dca8528a61e47091b2d153f087565f342c Mon Sep 17 00:00:00 2001 From: James Edwards-Jones Date: Tue, 13 Dec 2016 21:45:09 +0000 Subject: Update MergeRequest API state_event option documentation --- doc/api/merge_requests.md | 9 +++++---- lib/api/merge_requests.rb | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 1cf7632d60c..6ee377125d6 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -350,16 +350,17 @@ PUT /projects/:id/merge_requests/:merge_request_id | --------- | ---- | -------- | ----------- | | `id` | string | yes | The ID of a project | | `merge_request_id` | integer | yes | The ID of a merge request | -| `source_branch` | string | yes | The source branch | -| `target_branch` | string | yes | The target branch | -| `title` | string | yes | Title of MR | +| `target_branch` | string | no | The target branch | +| `title` | string | no | Title of MR | | `assignee_id` | integer | no | Assignee user ID | | `description` | string | no | Description of MR | -| `target_project_id` | integer | no | The target project (numeric id) | +| `state_event` | string | no | New state (close/reopen) | | `labels` | string | no | Labels for MR as a comma-separated list | | `milestone_id` | integer | no | The ID of a milestone | | `remove_source_branch` | boolean | no | Flag indicating if a merge request should remove the source branch when merging | +Must include at least one non-required attribute from above. + ```json { "id": 1, diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 782147883c8..8e09a6f7354 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -138,7 +138,7 @@ module API params do optional :title, type: String, allow_blank: false, desc: 'The title of the merge request' optional :target_branch, type: String, allow_blank: false, desc: 'The target branch' - optional :state_event, type: String, values: %w[close reopen merge], + optional :state_event, type: String, values: %w[close reopen], desc: 'Status of the merge request' use :optional_params at_least_one_of :title, :target_branch, :description, :assignee_id, -- cgit v1.2.1 From fe04d920544c0234d22aa5a8c7c6793a99d3e267 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 9 Feb 2017 16:38:09 +0000 Subject: Update PROCESS.md Signed-off-by: Dmitriy Zaporozhets --- PROCESS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PROCESS.md b/PROCESS.md index f257c1d5358..fead93bd4cf 100644 --- a/PROCESS.md +++ b/PROCESS.md @@ -59,7 +59,7 @@ star, smile, etc.). Some good tips about code reviews can be found in our ## Feature Freeze -On the 7th of each month, RC1 of the upcoming release is created and deployed to GitLab.com and the stable branch for this release is frozen, which means master is no longer merged into it. +After the 7th (Pacific Standard Time Zone) of each month, RC1 of the upcoming release is created and deployed to GitLab.com and the stable branch for this release is frozen, which means master is no longer merged into it. Merge requests may still be merged into master during this period, but they will go into the _next_ release, unless they are manually cherry-picked into the stable branch. By freezing the stable branches 2 weeks prior to a release, we reduce the risk of a last minute merge request potentially breaking things. -- cgit v1.2.1 From 0d9cce410dd146e512dc84fdb39bff13929a1362 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 9 Feb 2017 20:21:31 -0500 Subject: Remove a transient failure from spec/requests/api/groups_spec.rb --- spec/requests/api/groups_spec.rb | 8 +++++--- spec/support/matchers/satisfy_matchers.rb | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 spec/support/matchers/satisfy_matchers.rb diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 15592f1f702..f78bde6f53a 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -35,7 +35,8 @@ describe API::Groups, api: true do expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.length).to eq(1) - expect(json_response.first['name']).to eq(group1.name) + expect(json_response) + .to satisfy_one { |group| group['name'] == group1.name } end it "does not include statistics" do @@ -70,7 +71,7 @@ describe API::Groups, api: true do repository_size: 123, lfs_objects_size: 234, build_artifacts_size: 345, - } + }.stringify_keys project1.statistics.update!(attributes) @@ -78,7 +79,8 @@ describe API::Groups, api: true do expect(response).to have_http_status(200) expect(json_response).to be_an Array - expect(json_response.first['statistics']).to eq attributes.stringify_keys + expect(json_response) + .to satisfy_one { |group| group['statistics'] == attributes } end end diff --git a/spec/support/matchers/satisfy_matchers.rb b/spec/support/matchers/satisfy_matchers.rb new file mode 100644 index 00000000000..585915bac93 --- /dev/null +++ b/spec/support/matchers/satisfy_matchers.rb @@ -0,0 +1,19 @@ +# These matchers are a syntactic hack to provide more readable expectations for +# an Enumerable object. +# +# They take advantage of the `all?`, `none?`, and `one?` methods, and the fact +# that RSpec provides a `be_something` matcher for all predicates. +# +# Example: +# +# # Ensure exactly one object in an Array satisfies a condition +# expect(users.one? { |u| u.admin? }).to eq true +# +# # The same thing, but using the `be_one` matcher +# expect(users).to be_one { |u| u.admin? } +# +# # The same thing again, but using `satisfy_one` for improved readability +# expect(users).to satisfy_one { |u| u.admin? } +RSpec::Matchers.alias_matcher :satisfy_all, :be_all +RSpec::Matchers.alias_matcher :satisfy_none, :be_none +RSpec::Matchers.alias_matcher :satisfy_one, :be_one -- cgit v1.2.1 From be88e942a85a51ad267502e577ee578f58f3f226 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 10 Feb 2017 01:07:11 -0600 Subject: Show Pipeline(not Job) in MR desktop notification Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/27955 --- app/views/projects/merge_requests/widget/_show.html.haml | 4 ++-- changelogs/unreleased/27955-mr-notification-use-pipeline-language.yml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/27955-mr-notification-use-pipeline-language.yml diff --git a/app/views/projects/merge_requests/widget/_show.html.haml b/app/views/projects/merge_requests/widget/_show.html.haml index 5de59473840..4c063747857 100644 --- a/app/views/projects/merge_requests/widget/_show.html.haml +++ b/app/views/projects/merge_requests/widget/_show.html.haml @@ -16,13 +16,13 @@ gitlab_icon: "#{asset_path 'gitlab_logo.png'}", ci_status: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.status : ''}", ci_message: { - normal: "Job {{status}} for \"{{title}}\"", + normal: "Pipeline {{status}} for \"{{title}}\"", preparing: "{{status}} job for \"{{title}}\"" }, ci_enable: #{@project.ci_service ? "true" : "false"}, ci_title: { preparing: "{{status}} job", - normal: "Job {{status}}" + normal: "Pipeline {{status}}" }, ci_sha: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.short_sha : ''}", ci_pipeline: #{@merge_request.head_pipeline.try(:id).to_json}, diff --git a/changelogs/unreleased/27955-mr-notification-use-pipeline-language.yml b/changelogs/unreleased/27955-mr-notification-use-pipeline-language.yml new file mode 100644 index 00000000000..d9f78db4bec --- /dev/null +++ b/changelogs/unreleased/27955-mr-notification-use-pipeline-language.yml @@ -0,0 +1,4 @@ +--- +title: Show Pipeline(not Job) in MR desktop notification +merge_request: +author: -- cgit v1.2.1 From 9eb81331457a480251218dd837867fd6e2a6e3f6 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 10 Feb 2017 16:33:10 +0800 Subject: Make sure our current .gitlab-ci.yml is valid This could prevent errors described in: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8970 Everything we're using right now, should be valid of course. --- spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index 008c15c4de3..68ad429608d 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -4,6 +4,16 @@ module Ci describe GitlabCiYamlProcessor, lib: true do let(:path) { 'path' } + describe 'our current .gitlab-ci.yml' do + let(:config) { File.read("#{Rails.root}/.gitlab-ci.yml") } + + it 'is valid' do + error_message = described_class.validation_message(config) + + expect(error_message).to be_nil + end + end + describe '#build_attributes' do describe 'coverage entry' do subject { described_class.new(config, path).build_attributes(:rspec) } -- cgit v1.2.1 From d1ecbd6ce8c3dac8228397259a3fd41cbb1577f8 Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Fri, 10 Feb 2017 11:44:00 -0200 Subject: Fix admin_labels_spec.rb transient failure --- spec/features/admin/admin_labels_spec.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index eaa42aad0a7..6d6c9165c83 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -35,15 +35,16 @@ RSpec.describe 'admin issues labels' do it 'deletes all labels', js: true do page.within '.labels' do page.all('.btn-remove').each do |remove| - wait_for_ajax remove.click + wait_for_ajax end end - page.within '.manage-labels-list' do - expect(page).not_to have_content('bug') - expect(page).not_to have_content('feature_label') - end + wait_for_ajax + + expect(page).to have_content("There are no labels yet") + expect(page).not_to have_content('bug') + expect(page).not_to have_content('feature_label') end end -- cgit v1.2.1