diff options
-rw-r--r-- | CHANGELOG | 5 | ||||
-rw-r--r-- | app/finders/issuable_finder.rb | 16 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 5 | ||||
-rw-r--r-- | app/models/merge_request.rb | 18 | ||||
-rw-r--r-- | app/models/milestone.rb | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_merge_request.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/merge_requests/show/_mr_title.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/merge_requests/widget/_closed.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/widget/_merged.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/milestones/show.html.haml | 4 | ||||
-rw-r--r-- | app/views/search/results/_merge_request.html.haml | 4 | ||||
-rw-r--r-- | app/views/shared/_issuable_filter.html.haml | 6 | ||||
-rw-r--r-- | features/project/merge_requests.feature | 2 | ||||
-rw-r--r-- | features/steps/project/merge_requests.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 5 |
15 files changed, 45 insertions, 45 deletions
diff --git a/CHANGELOG b/CHANGELOG index 455a4339420..53258e7fd1a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 0bed2115dc7..2eccc0ee31f 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -45,10 +45,10 @@ class IssuableFinder def group return @group if defined?(@group) - @group = + @group = if params[:group_id].present? Group.find(params[:group_id]) - else + else nil end end @@ -56,10 +56,10 @@ class IssuableFinder def project return @project if defined?(@project) - @project = + @project = if params[:project_id].present? Project.find(params[:project_id]) - else + else nil end end @@ -76,7 +76,7 @@ class IssuableFinder return @milestones if defined?(@milestones) @milestones = - if milestones? && params[:milestone_title] != NONE + if milestones? && params[:milestone_title] != NONE Milestone.where(title: params[:milestone_title]) else nil @@ -90,7 +90,7 @@ class IssuableFinder def assignee return @assignee if defined?(@assignee) - @assignee = + @assignee = if assignee? && params[:assignee_id] != NONE User.find(params[:assignee_id]) else @@ -105,7 +105,7 @@ class IssuableFinder def author return @author if defined?(@author) - @author = + @author = if author? && params[:author_id] != NONE User.find(params[:author_id]) else @@ -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' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9889c995c74..0b46db4b1c3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -281,10 +281,9 @@ module ApplicationHelper def state_filters_text_for(entity, project) titles = { - opened: "Open", - merged: "Accepted" + opened: "Open" } - + entity_title = titles[entity] || entity.to_s.humanize count = diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 487d62e65b6..7ecdaf6b2e0 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -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 diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 9c543b37023..e0c5fec97b7 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -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 diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index d79c4548247..0bcd543fee7 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -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< diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml index 0690fdb769f..83baf157a92 100644 --- a/app/views/projects/merge_requests/show/_mr_title.html.haml +++ b/app/views/projects/merge_requests/show/_mr_title.html.haml @@ -1,11 +1,6 @@ %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 · diff --git a/app/views/projects/merge_requests/widget/_closed.html.haml b/app/views/projects/merge_requests/widget/_closed.html.haml index 18164ba771f..b5704c502c8 100644 --- a/app/views/projects/merge_requests/widget/_closed.html.haml +++ b/app/views/projects/merge_requests/widget/_closed.html.haml @@ -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)} diff --git a/app/views/projects/merge_requests/widget/_merged.html.haml b/app/views/projects/merge_requests/widget/_merged.html.haml index 17c3fdacda8..a3b13140810 100644 --- a/app/views/projects/merge_requests/widget/_merged.html.haml +++ b/app/views/projects/merge_requests/widget/_merged.html.haml @@ -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)} diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 417eaa1b09d..5c85092a045 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -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 diff --git a/app/views/search/results/_merge_request.html.haml b/app/views/search/results/_merge_request.html.haml index adfdd1c7506..2efa616d664 100644 --- a/app/views/search/results/_merge_request.html.haml +++ b/app/views/search/results/_merge_request.html.haml @@ -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 diff --git a/app/views/shared/_issuable_filter.html.haml b/app/views/shared/_issuable_filter.html.haml index a5187fa4ea7..a355eb62813 100644 --- a/app/views/shared/_issuable_filter.html.haml +++ b/app/views/shared/_issuable_filter.html.haml @@ -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 diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index eb091c291e9..d043badbc46 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -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 diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index b072fef235e..5684d661527 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -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 diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 70dd8049b12..2887221fb46 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -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 |