Commit 159f959b authored by Rémy Coutable's avatar Rémy Coutable Committed by Robert Speicher

Move due_date sort scopes to Issue and fix CHANGELOG

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 6cdf4acd
......@@ -189,7 +189,9 @@ v 8.6.1
- Fixes issue with assign milestone not loading milestone list. !3346
- Fix an issue causing the Dashboard/Milestones page to be blank. !3348
v 8.6.0 (unreleased)
v 8.6.0
- Add ability to move issue to another project
- Prevent tokens in the import URL to be showed by the UI
- Fix bug where wrong commit ID was being used in a merge request diff to show old image (Stan Hu)
- Add confidential issues
- Bump gitlab_git to 9.0.3 (Stan Hu)
......
......@@ -114,7 +114,7 @@ class IssuableFinder
end
def due_date?
params[:due_date].present?
params[:due_date].present? && klass.column_names.include?('due_date')
end
def filter_by_no_due_date?
......@@ -305,8 +305,6 @@ class IssuableFinder
end
def by_due_date(items)
return items unless klass.column_names.include?('due_date')
if due_date?
if filter_by_no_due_date?
items = items.without_due_date
......
......@@ -18,8 +18,6 @@ module Sortable
scope :order_updated_asc, -> { reorder(updated_at: :asc) }
scope :order_name_asc, -> { reorder(name: :asc) }
scope :order_name_desc, -> { reorder(name: :desc) }
scope :order_due_date_asc, -> { reorder("issues.due_date IS NULL, issues.due_date ASC") }
scope :order_due_date_desc, -> { reorder("issues.due_date IS NULL, issues.due_date DESC") }
end
module ClassMethods
......@@ -33,8 +31,6 @@ module Sortable
when 'created_desc' then order_created_desc
when 'id_desc' then order_id_desc
when 'id_asc' then order_id_asc
when 'due_date_asc', 'due_date_desc'
column_names.include?('due_date') ? send("order_#{method}") : all
else
all
end
......
......@@ -46,6 +46,9 @@ class Issue < ActiveRecord::Base
scope :open_for, ->(user) { opened.assigned_to(user) }
scope :in_projects, ->(project_ids) { where(project_id: project_ids) }
scope :order_due_date_asc, -> { reorder('issues.due_date IS NULL, issues.due_date ASC') }
scope :order_due_date_desc, -> { reorder('issues.due_date IS NULL, issues.due_date DESC') }
state_machine :state, initial: :opened do
event :close do
transition [:reopened, :opened] => :closed
......@@ -89,6 +92,15 @@ class Issue < ActiveRecord::Base
@link_reference_pattern ||= super("issues", /(?<issue>\d+)/)
end
def self.sort(method)
case method.to_s
when 'due_date_asc' then order_due_date_asc
when 'due_date_desc' then order_due_date_desc
else
super
end
end
def to_reference(from_project = nil)
reference = "#{self.class.reference_prefix}#{iid}"
......
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