Commit 9eec0d54 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'accepted-rejected-mrs' into 'master'

Add Accepted and Rejected tabs to MR lists.

Before, MRs were referred to as Merged or Closed, but the Merge button on the MR page read "Accept Merge Request", the activity feed even read "X accepted merge request Y", and the Closed tab on the MR index included both Merged _and_ Closed MRs. I've changed every occurrence to consistently refer to MRs as either Accepted or Rejected, which is less technical and more clearly two opposites.

![Screen_Shot_2015-05-25_at_17.02.31](https://gitlab.com/gitlab-org/gitlab-ce/uploads/b0bf43aa1b5b9898a1c6b204dbcf669a/Screen_Shot_2015-05-25_at_17.02.31.png)

![Screen_Shot_2015-05-25_at_17.02.47](https://gitlab.com/gitlab-org/gitlab-ce/uploads/2ac05b1e1dba3b2d1692bd9242078f3a/Screen_Shot_2015-05-25_at_17.02.47.png)

![Screen_Shot_2015-05-25_at_17.03.03](https://gitlab.com/gitlab-org/gitlab-ce/uploads/4c0f0fa869c9130a6af18d80a1c6ebed/Screen_Shot_2015-05-25_at_17.03.03.png)

Addresses internal issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2201.

See merge request !702
parents 701c2e9a 7df45882
...@@ -17,6 +17,8 @@ v 7.12.0 (unreleased) ...@@ -17,6 +17,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.
- Add Accepted and Rejected tabs to MR lists.
v 7.11.2 v 7.11.2
- no changes - no changes
......
...@@ -75,6 +75,10 @@ class IssuableFinder ...@@ -75,6 +75,10 @@ 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'
items.respond_to?(:merged) ? items.merged : items.closed
when 'all' when 'all'
items items
when 'opened' when 'opened'
......
...@@ -330,7 +330,12 @@ module ApplicationHelper ...@@ -330,7 +330,12 @@ module ApplicationHelper
end end
def state_filters_text_for(entity, project) def state_filters_text_for(entity, project)
entity_title = entity.to_s.humanize titles = {
opened: "Open",
merged: "Accepted"
}
entity_title = titles[entity] || entity.to_s.humanize
count = count =
if project.nil? if project.nil?
......
...@@ -134,7 +134,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -134,7 +134,7 @@ class MergeRequest < ActiveRecord::Base
# Closed scope for merge request should return # Closed scope for merge request should return
# both merged and closed mr's # both merged and closed mr's
scope :closed, -> { with_states(:closed, :merged) } scope :closed, -> { with_states(:closed, :merged) }
scope :declined, -> { with_states(:closed) } scope :rejected, -> { with_states(:closed) }
def self.reference_prefix def self.reference_prefix
'!' '!'
......
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
= link_to issues_dashboard_url(format: :atom, private_token: current_user.private_token), class: 'btn' do = link_to issues_dashboard_url(format: :atom, private_token: current_user.private_token), class: 'btn' do
%i.fa.fa-rss %i.fa.fa-rss
= render 'shared/issuable_filter' = render 'shared/issuable_filter', type: :issues
= render 'shared/issues' = render 'shared/issues'
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
List all merge requests from all projects you have access to. List all merge requests from all projects you have access to.
%hr %hr
.append-bottom-20 .append-bottom-20
= render 'shared/issuable_filter' = render 'shared/issuable_filter', type: :merge_requests
= render 'shared/merge_requests' = render 'shared/merge_requests'
...@@ -21,5 +21,5 @@ ...@@ -21,5 +21,5 @@
= link_to issues_group_url(@group, format: :atom, private_token: current_user.private_token), class: 'btn' do = link_to issues_group_url(@group, format: :atom, private_token: current_user.private_token), class: 'btn' do
%i.fa.fa-rss %i.fa.fa-rss
= render 'shared/issuable_filter' = render 'shared/issuable_filter', type: :issues
= render 'shared/issues' = render 'shared/issues'
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page. To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page.
%hr %hr
.append-bottom-20 .append-bottom-20
= render 'shared/issuable_filter' = render 'shared/issuable_filter', type: :merge_requests
= render 'shared/merge_requests' = render 'shared/merge_requests'
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
%i.fa.fa-plus %i.fa.fa-plus
New Issue New Issue
= render 'shared/issuable_filter' = render 'shared/issuable_filter', type: :issues
.issues-holder .issues-holder
= render "issues" = render "issues"
...@@ -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
MERGED ACCEPTED
- elsif merge_request.closed? - elsif merge_request.closed?
%span %span
%i.fa.fa-close %i.fa.fa-ban
CLOSED REJECTED
- else - else
%span.hidden-xs.hidden-sm %span.hidden-xs.hidden-sm
%span.label-branch< %span.label-branch<
......
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
= link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-new pull-left", title: "New Merge Request" do = link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-new pull-left", title: "New Merge Request" do
%i.fa.fa-plus %i.fa.fa-plus
New Merge Request New Merge Request
= render 'shared/issuable_filter' = render 'shared/issuable_filter', type: :merge_requests
.merge-requests-holder .merge-requests-holder
= render 'merge_requests' = render 'merge_requests'
%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? - if @merge_request.merged?
Merged Accepted
- elsif @merge_request.closed? - elsif @merge_request.closed?
Closed Rejected
- else - else
Open Open
= "Merge Request ##{@merge_request.iid}" = "Merge Request ##{@merge_request.iid}"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
- if @merge_request.closed? - if @merge_request.closed?
%h4 %h4
Closed Rejected
- if @merge_request.closed_event - if @merge_request.closed_event
by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)} by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)}
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)} #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
- if @merge_request.merged? - if @merge_request.merged?
%h4 %h4
Merged Accepted
- if @merge_request.merge_event - if @merge_request.merge_event
by #{link_to_member(@project, @merge_request.merge_event.author, avatar: false)} by #{link_to_member(@project, @merge_request.merge_event.author, avatar: false)}
#{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: 'Declined (closed)', merge_requests: @merge_requests.declined, id: 'closed') = render('merge_requests', title: 'Rejected (closed)', merge_requests: @merge_requests.rejected, id: 'closed')
.col-md-3 .col-md-3
.panel.panel-primary .panel.panel-primary
.panel-heading Merged .panel-heading Accepted
%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 Merged %span.label.label-primary Accepted
- elsif merge_request.closed? - elsif merge_request.closed?
%span.label.label-danger Closed %span.label.label-danger Rejected
...@@ -3,15 +3,28 @@ ...@@ -3,15 +3,28 @@
%ul.nav.nav-tabs %ul.nav.nav-tabs
%li{class: ("active" if params[:state] == 'opened')} %li{class: ("active" if params[:state] == 'opened')}
= link_to page_filter_path(state: 'opened') do = link_to page_filter_path(state: 'opened') do
%i.fa.fa-exclamation-circle = icon('exclamation-circle')
#{state_filters_text_for(:opened, @project)} #{state_filters_text_for(:opened, @project)}
- if defined?(type) && type == :merge_requests
%li{class: ("active" if params[:state] == 'merged')}
= link_to page_filter_path(state: 'merged') do
= icon('check-circle')
#{state_filters_text_for(:merged, @project)}
%li{class: ("active" if params[:state] == 'rejected')}
= link_to page_filter_path(state: 'rejected') do
= icon('ban')
#{state_filters_text_for(:rejected, @project)}
- 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
%i.fa.fa-check-circle = icon('check-circle')
#{state_filters_text_for(:closed, @project)} #{state_filters_text_for(:closed, @project)}
%li{class: ("active" if params[:state] == 'all')} %li{class: ("active" if params[:state] == 'all')}
= link_to page_filter_path(state: 'all') do = link_to page_filter_path(state: 'all') do
%i.fa.fa-compass = icon('compass')
#{state_filters_text_for(:all, @project)} #{state_filters_text_for(:all, @project)}
.issues-details-filters .issues-details-filters
......
...@@ -10,8 +10,8 @@ Feature: Project Merge Requests ...@@ -10,8 +10,8 @@ Feature: Project Merge Requests
Then I should see "Bug NS-04" in merge requests Then I should see "Bug NS-04" in 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 closed merge requests Scenario: I should see rejected merge requests
Given I click link "Closed" Given I click link "Rejected"
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 "Closed"' do step 'I click link "Rejected"' do
click_link "Closed" click_link "Rejected"
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")
merge_request.closed?.should be_true merge_request.closed?.should be_true
page.should have_content "Closed by" page.should have_content "Rejected by"
end end
step 'I should see merge request "Bug NS-04"' do step 'I should see merge request "Bug NS-04"' do
...@@ -202,7 +202,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -202,7 +202,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see merged request' do step 'I should see merged request' do
within '.issue-box' do within '.issue-box' do
page.should have_content "Merged" page.should have_content "Accepted"
end end
end end
......
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