BigW Consortium Gitlab

Unverified Commit cc9b5c49 by Dmitriy Zaporozhets

Merge branch 'revert-mr-state-names'

Signed-off-by: 's 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)
- 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
- 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)
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
......@@ -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)
- Fix new/empty milestones showing 100% completion value (Jonah Bishop)
- Add a note when an Issue or Merge Request's title changes
- Consistently refer to MRs as either Accepted or Rejected.
- Add Accepted and Rejected tabs to MR lists.
- Consistently refer to MRs as either Merged or Closed.
- Add Merged tab to MR lists.
- Prefix EmailsOnPush email subject with `[Git]`.
- Group project contributions by both name and email.
- Clarify navigation labels for Project Settings and Group Settings.
......
......@@ -148,8 +148,6 @@ class IssuableFinder
case params[:state]
when 'closed'
items.closed
when 'rejected'
items.respond_to?(:rejected) ? items.rejected : items.closed
when 'merged'
items.respond_to?(:merged) ? items.merged : items.closed
when 'all'
......
......@@ -281,8 +281,7 @@ module ApplicationHelper
def state_filters_text_for(entity, project)
titles = {
opened: "Open",
merged: "Accepted"
opened: "Open"
}
entity_title = titles[entity] || entity.to_s.humanize
......
......@@ -125,16 +125,14 @@ class MergeRequest < ActiveRecord::Base
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 :merged, -> { with_state(:merged) }
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 :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 :of_projects, ->(ids) { where(target_project_id: ids) }
# Closed scope for merge request should return
# both merged and closed mr's
scope :closed, -> { with_states(:closed, :merged) }
scope :rejected, -> { with_states(:closed) }
scope :merged, -> { with_state(:merged) }
scope :closed, -> { with_state(:closed) }
scope :closed_and_merged, -> { with_states(:closed, :merged) }
def self.reference_prefix
'!'
......@@ -417,4 +415,14 @@ class MergeRequest < ActiveRecord::Base
def can_be_merged_by?(user)
::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch)
end
def state_human_name
if merged?
"Merged"
elsif closed?
"Closed"
else
"Open"
end
end
end
......@@ -56,7 +56,7 @@ class Milestone < ActiveRecord::Base
end
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
def total_items_count
......
......@@ -9,11 +9,11 @@
- if merge_request.merged?
%span
%i.fa.fa-check
ACCEPTED
MERGED
- elsif merge_request.closed?
%span
%i.fa.fa-ban
REJECTED
CLOSED
- else
%span.hidden-xs.hidden-sm
%span.label-branch<
......
%h4.page-title
.issue-box{ class: issue_box_class(@merge_request) }
- if @merge_request.merged?
Accepted
- elsif @merge_request.closed?
Rejected
- else
Open
= @merge_request.state_human_name
= "Merge Request ##{@merge_request.iid}"
%small.creator
&middot;
......
......@@ -2,7 +2,7 @@
= render 'projects/merge_requests/widget/heading'
.mr-widget-body
%h4
Rejected
Closed
- if @merge_request.closed_event
by #{link_to_member(@project, @merge_request.closed_event.author, avatar: true)}
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
......
......@@ -2,7 +2,7 @@
= render 'projects/merge_requests/widget/heading'
.mr-widget-body
%h4
Accepted
Merged
- if @merge_request.merge_event
by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)}
#{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
......
......@@ -86,10 +86,10 @@
.col-md-3
= render('merge_requests', title: 'Waiting for merge (open and assigned)', merge_requests: @merge_requests.opened.assigned, id: 'ongoing')
.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
.panel.panel-primary
.panel-heading Accepted
.panel-heading Merged
%ul.well-list
- @merge_requests.merged.each do |merge_request|
= render 'merge_request', merge_request: merge_request
......
......@@ -11,6 +11,6 @@
#{merge_request.project.name_with_namespace}
.pull-right
- if merge_request.merged?
%span.label.label-primary Accepted
%span.label.label-primary Merged
- elsif merge_request.closed?
%span.label.label-danger Rejected
%span.label.label-danger Closed
......@@ -12,10 +12,10 @@
= icon('check-circle')
#{state_filters_text_for(:merged, @project)}
%li{class: ("active" if params[:state] == 'rejected')}
= link_to page_filter_path(state: 'rejected') do
%li{class: ("active" if params[:state] == 'closed')}
= link_to page_filter_path(state: 'closed') do
= icon('ban')
#{state_filters_text_for(:rejected, @project)}
#{state_filters_text_for(:closed, @project)}
- else
%li{class: ("active" if params[:state] == 'closed')}
= link_to page_filter_path(state: 'closed') do
......
......@@ -11,7 +11,7 @@ Feature: Project Merge Requests
And I should not see "Feature NS-03" in 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
And I should not see "Bug NS-04" in merge requests
......
......@@ -19,8 +19,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
click_link "All"
end
step 'I click link "Rejected"' do
click_link "Rejected"
step 'I click link "Closed"' do
click_link "Closed"
end
step 'I should see merge request "Wiki Feature"' do
......@@ -32,7 +32,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by!(title: "Bug NS-04")
expect(merge_request).to be_closed
expect(page).to have_content 'Rejected by'
expect(page).to have_content "Closed by"
end
step 'I should see merge request "Bug NS-04"' do
......@@ -212,7 +212,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see merged request' do
page.within '.issue-box' do
expect(page).to have_content "Accepted"
expect(page).to have_content "Merged"
end
end
......
......@@ -49,9 +49,8 @@ describe API::API, api: true do
get api("/projects/#{project.id}/merge_requests?state=closed", user)
expect(response.status).to eq(200)
expect(json_response).to be_an Array
expect(json_response.length).to eq(2)
expect(json_response.second['title']).to eq(merge_request_closed.title)
expect(json_response.first['title']).to eq(merge_request_merged.title)
expect(json_response.length).to eq(1)
expect(json_response.first['title']).to eq(merge_request_closed.title)
end
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