Commit cc9b5c49 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'revert-mr-state-names'

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	features/steps/project/merge_requests.rb
parents bcb07929 967214b2
...@@ -9,6 +9,7 @@ v 7.13.0 (unreleased) ...@@ -9,6 +9,7 @@ v 7.13.0 (unreleased)
- Allow users to customize their default Dashboard page. - Allow users to customize their default Dashboard page.
- Update ssl_ciphers in Nginx example to remove DHE settings. This will deny forward secrecy for Android 2.3.7, Java 6 and OpenSSL 0.9.8 - Update ssl_ciphers in Nginx example to remove DHE settings. This will deny forward secrecy for Android 2.3.7, Java 6 and OpenSSL 0.9.8
- Convert CRLF newlines to LF when committing using the web editor. - Convert CRLF newlines to LF when committing using the web editor.
- API request /projects/:project_id/merge_requests?state=closed will return only closed merge requests without merged one. If you need ones that were merged - use state=merged.
v 7.12.0 (unreleased) v 7.12.0 (unreleased)
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu) - Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
...@@ -51,8 +52,8 @@ v 7.12.0 (unreleased) ...@@ -51,8 +52,8 @@ v 7.12.0 (unreleased)
- Add validation to wiki page creation (only [a-zA-Z0-9/_-] are allowed) (Jeroen van Baarsen) - Add validation to wiki page creation (only [a-zA-Z0-9/_-] are allowed) (Jeroen van Baarsen)
- Fix new/empty milestones showing 100% completion value (Jonah Bishop) - Fix new/empty milestones showing 100% completion value (Jonah Bishop)
- Add a note when an Issue or Merge Request's title changes - Add a note when an Issue or Merge Request's title changes
- Consistently refer to MRs as either Accepted or Rejected. - Consistently refer to MRs as either Merged or Closed.
- Add Accepted and Rejected tabs to MR lists. - Add Merged tab to MR lists.
- Prefix EmailsOnPush email subject with `[Git]`. - Prefix EmailsOnPush email subject with `[Git]`.
- Group project contributions by both name and email. - Group project contributions by both name and email.
- Clarify navigation labels for Project Settings and Group Settings. - Clarify navigation labels for Project Settings and Group Settings.
......
...@@ -148,8 +148,6 @@ class IssuableFinder ...@@ -148,8 +148,6 @@ class IssuableFinder
case params[:state] case params[:state]
when 'closed' when 'closed'
items.closed items.closed
when 'rejected'
items.respond_to?(:rejected) ? items.rejected : items.closed
when 'merged' when 'merged'
items.respond_to?(:merged) ? items.merged : items.closed items.respond_to?(:merged) ? items.merged : items.closed
when 'all' when 'all'
......
...@@ -281,8 +281,7 @@ module ApplicationHelper ...@@ -281,8 +281,7 @@ module ApplicationHelper
def state_filters_text_for(entity, project) def state_filters_text_for(entity, project)
titles = { titles = {
opened: "Open", opened: "Open"
merged: "Accepted"
} }
entity_title = titles[entity] || entity.to_s.humanize entity_title = titles[entity] || entity.to_s.humanize
......
...@@ -125,16 +125,14 @@ class MergeRequest < ActiveRecord::Base ...@@ -125,16 +125,14 @@ class MergeRequest < ActiveRecord::Base
validate :validate_fork validate :validate_fork
scope :of_group, ->(group) { where("source_project_id in (:group_project_ids) OR target_project_id in (:group_project_ids)", group_project_ids: group.project_ids) } scope :of_group, ->(group) { where("source_project_id in (:group_project_ids) OR target_project_id in (:group_project_ids)", group_project_ids: group.project_ids) }
scope :merged, -> { with_state(:merged) }
scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) } scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) }
scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) } scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) }
scope :by_milestone, ->(milestone) { where(milestone_id: milestone) } scope :by_milestone, ->(milestone) { where(milestone_id: milestone) }
scope :in_projects, ->(project_ids) { where("source_project_id in (:project_ids) OR target_project_id in (:project_ids)", project_ids: project_ids) } scope :in_projects, ->(project_ids) { where("source_project_id in (:project_ids) OR target_project_id in (:project_ids)", project_ids: project_ids) }
scope :of_projects, ->(ids) { where(target_project_id: ids) } scope :of_projects, ->(ids) { where(target_project_id: ids) }
# Closed scope for merge request should return scope :merged, -> { with_state(:merged) }
# both merged and closed mr's scope :closed, -> { with_state(:closed) }
scope :closed, -> { with_states(:closed, :merged) } scope :closed_and_merged, -> { with_states(:closed, :merged) }
scope :rejected, -> { with_states(:closed) }
def self.reference_prefix def self.reference_prefix
'!' '!'
...@@ -417,4 +415,14 @@ class MergeRequest < ActiveRecord::Base ...@@ -417,4 +415,14 @@ class MergeRequest < ActiveRecord::Base
def can_be_merged_by?(user) def can_be_merged_by?(user)
::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch) ::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch)
end end
def state_human_name
if merged?
"Merged"
elsif closed?
"Closed"
else
"Open"
end
end
end end
...@@ -56,7 +56,7 @@ class Milestone < ActiveRecord::Base ...@@ -56,7 +56,7 @@ class Milestone < ActiveRecord::Base
end end
def closed_items_count def closed_items_count
self.issues.closed.count + self.merge_requests.closed.count self.issues.closed.count + self.merge_requests.closed_and_merged.count
end end
def total_items_count def total_items_count
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
- if merge_request.merged? - if merge_request.merged?
%span %span
%i.fa.fa-check %i.fa.fa-check
ACCEPTED MERGED
- elsif merge_request.closed? - elsif merge_request.closed?
%span %span
%i.fa.fa-ban %i.fa.fa-ban
REJECTED CLOSED
- else - else
%span.hidden-xs.hidden-sm %span.hidden-xs.hidden-sm
%span.label-branch< %span.label-branch<
......
%h4.page-title %h4.page-title
.issue-box{ class: issue_box_class(@merge_request) } .issue-box{ class: issue_box_class(@merge_request) }
- if @merge_request.merged? = @merge_request.state_human_name
Accepted
- elsif @merge_request.closed?
Rejected
- else
Open
= "Merge Request ##{@merge_request.iid}" = "Merge Request ##{@merge_request.iid}"
%small.creator %small.creator
&middot; &middot;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
= render 'projects/merge_requests/widget/heading' = render 'projects/merge_requests/widget/heading'
.mr-widget-body .mr-widget-body
%h4 %h4
Rejected Closed
- if @merge_request.closed_event - if @merge_request.closed_event
by #{link_to_member(@project, @merge_request.closed_event.author, avatar: true)} by #{link_to_member(@project, @merge_request.closed_event.author, avatar: true)}
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)} #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
= render 'projects/merge_requests/widget/heading' = render 'projects/merge_requests/widget/heading'
.mr-widget-body .mr-widget-body
%h4 %h4
Accepted Merged
- if @merge_request.merge_event - if @merge_request.merge_event
by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)} by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)}
#{time_ago_with_tooltip(@merge_request.merge_event.created_at)} #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
......
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
.col-md-3 .col-md-3
= render('merge_requests', title: 'Waiting for merge (open and assigned)', merge_requests: @merge_requests.opened.assigned, id: 'ongoing') = render('merge_requests', title: 'Waiting for merge (open and assigned)', merge_requests: @merge_requests.opened.assigned, id: 'ongoing')
.col-md-3 .col-md-3
= render('merge_requests', title: 'Rejected (closed)', merge_requests: @merge_requests.rejected, id: 'closed') = render('merge_requests', title: 'Rejected (closed)', merge_requests: @merge_requests.closed, id: 'closed')
.col-md-3 .col-md-3
.panel.panel-primary .panel.panel-primary
.panel-heading Accepted .panel-heading Merged
%ul.well-list %ul.well-list
- @merge_requests.merged.each do |merge_request| - @merge_requests.merged.each do |merge_request|
= render 'merge_request', merge_request: merge_request = render 'merge_request', merge_request: merge_request
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#{merge_request.project.name_with_namespace} #{merge_request.project.name_with_namespace}
.pull-right .pull-right
- if merge_request.merged? - if merge_request.merged?
%span.label.label-primary Accepted %span.label.label-primary Merged
- elsif merge_request.closed? - elsif merge_request.closed?
%span.label.label-danger Rejected %span.label.label-danger Closed
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
= icon('check-circle') = icon('check-circle')
#{state_filters_text_for(:merged, @project)} #{state_filters_text_for(:merged, @project)}
%li{class: ("active" if params[:state] == 'rejected')} %li{class: ("active" if params[:state] == 'closed')}
= link_to page_filter_path(state: 'rejected') do = link_to page_filter_path(state: 'closed') do
= icon('ban') = icon('ban')
#{state_filters_text_for(:rejected, @project)} #{state_filters_text_for(:closed, @project)}
- else - else
%li{class: ("active" if params[:state] == 'closed')} %li{class: ("active" if params[:state] == 'closed')}
= link_to page_filter_path(state: 'closed') do = link_to page_filter_path(state: 'closed') do
......
...@@ -11,7 +11,7 @@ Feature: Project Merge Requests ...@@ -11,7 +11,7 @@ Feature: Project Merge Requests
And I should not see "Feature NS-03" in merge requests And I should not see "Feature NS-03" in merge requests
Scenario: I should see rejected merge requests Scenario: I should see rejected merge requests
Given I click link "Rejected" Given I click link "Closed"
Then I should see "Feature NS-03" in merge requests Then I should see "Feature NS-03" in merge requests
And I should not see "Bug NS-04" in merge requests And I should not see "Bug NS-04" in merge requests
......
...@@ -19,8 +19,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -19,8 +19,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
click_link "All" click_link "All"
end end
step 'I click link "Rejected"' do step 'I click link "Closed"' do
click_link "Rejected" click_link "Closed"
end end
step 'I should see merge request "Wiki Feature"' do step 'I should see merge request "Wiki Feature"' do
...@@ -32,7 +32,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -32,7 +32,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see closed merge request "Bug NS-04"' do step 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by!(title: "Bug NS-04") merge_request = MergeRequest.find_by!(title: "Bug NS-04")
expect(merge_request).to be_closed expect(merge_request).to be_closed
expect(page).to have_content 'Rejected by' expect(page).to have_content "Closed by"
end end
step 'I should see merge request "Bug NS-04"' do step 'I should see merge request "Bug NS-04"' do
...@@ -212,7 +212,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -212,7 +212,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see merged request' do step 'I should see merged request' do
page.within '.issue-box' do page.within '.issue-box' do
expect(page).to have_content "Accepted" expect(page).to have_content "Merged"
end end
end end
......
...@@ -49,9 +49,8 @@ describe API::API, api: true do ...@@ -49,9 +49,8 @@ describe API::API, api: true do
get api("/projects/#{project.id}/merge_requests?state=closed", user) get api("/projects/#{project.id}/merge_requests?state=closed", user)
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.length).to eq(2) expect(json_response.length).to eq(1)
expect(json_response.second['title']).to eq(merge_request_closed.title) expect(json_response.first['title']).to eq(merge_request_closed.title)
expect(json_response.first['title']).to eq(merge_request_merged.title)
end end
it "should return an array of merged merge_requests" do it "should return an array of merged merge_requests" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment