Commit 8c542370 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Revert merge request states renaming

Replaced:
* "Accepted" with "Merged"
* "Rejected" with "Closed"
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent baa699a7
...@@ -47,8 +47,8 @@ v 7.12.0 (unreleased) ...@@ -47,8 +47,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.
......
...@@ -45,10 +45,10 @@ class IssuableFinder ...@@ -45,10 +45,10 @@ class IssuableFinder
def group def group
return @group if defined?(@group) return @group if defined?(@group)
@group = @group =
if params[:group_id].present? if params[:group_id].present?
Group.find(params[:group_id]) Group.find(params[:group_id])
else else
nil nil
end end
end end
...@@ -56,10 +56,10 @@ class IssuableFinder ...@@ -56,10 +56,10 @@ class IssuableFinder
def project def project
return @project if defined?(@project) return @project if defined?(@project)
@project = @project =
if params[:project_id].present? if params[:project_id].present?
Project.find(params[:project_id]) Project.find(params[:project_id])
else else
nil nil
end end
end end
...@@ -76,7 +76,7 @@ class IssuableFinder ...@@ -76,7 +76,7 @@ class IssuableFinder
return @milestones if defined?(@milestones) return @milestones if defined?(@milestones)
@milestones = @milestones =
if milestones? && params[:milestone_title] != NONE if milestones? && params[:milestone_title] != NONE
Milestone.where(title: params[:milestone_title]) Milestone.where(title: params[:milestone_title])
else else
nil nil
...@@ -90,7 +90,7 @@ class IssuableFinder ...@@ -90,7 +90,7 @@ class IssuableFinder
def assignee def assignee
return @assignee if defined?(@assignee) return @assignee if defined?(@assignee)
@assignee = @assignee =
if assignee? && params[:assignee_id] != NONE if assignee? && params[:assignee_id] != NONE
User.find(params[:assignee_id]) User.find(params[:assignee_id])
else else
...@@ -105,7 +105,7 @@ class IssuableFinder ...@@ -105,7 +105,7 @@ class IssuableFinder
def author def author
return @author if defined?(@author) return @author if defined?(@author)
@author = @author =
if author? && params[:author_id] != NONE if author? && params[:author_id] != NONE
User.find(params[:author_id]) User.find(params[:author_id])
else else
...@@ -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'
......
...@@ -327,10 +327,9 @@ module ApplicationHelper ...@@ -327,10 +327,9 @@ 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
count = count =
......
...@@ -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)}
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
= render('merge_requests', title: 'Rejected (closed)', merge_requests: @merge_requests.rejected, 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 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.closed?).to be_true expect(merge_request.closed?).to be_true
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
...@@ -206,7 +206,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -206,7 +206,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
......
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