Commit 627f494a authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Update IssuableCollections overrides

parent 5695ec95
......@@ -86,14 +86,15 @@ module IssuableCollections
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def finder_options
params[:state] = default_state if params[:state].blank?
options = {
scope: params[:scope],
state: params[:state].presence || 'opened',
state: params[:state],
sort: set_sort_order_from_cookie || default_sort_order
}
# Used by view to highlight active option
params[:state] = options[:state]
@sort = options[:sort]
if @project
......@@ -108,6 +109,10 @@ module IssuableCollections
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
def default_state
'opened'
end
def set_sort_order_from_cookie
sort_param = params[:sort] if params[:sort].present?
# fallback to legacy cookie value for backward compatibility
......
......@@ -36,7 +36,7 @@ module EE
end
def export_csv
ExportCsvWorker.perform_async(current_user.id, project.id, filter_params.to_h)
ExportCsvWorker.perform_async(current_user.id, project.id, finder_options.to_h)
index_path = project_issues_path(project)
redirect_to(index_path, notice: "Your CSV export has started. It will be emailed to #{current_user.notification_email} when complete.")
......@@ -51,16 +51,16 @@ module EE
attrs
end
def filter_params
params = super
params.reject! { |key| key == 'weight' } unless project.feature_available?(:issue_weights)
def finder_options
options = super
options.reject! { |key| key == 'weight' } unless project.feature_available?(:issue_weights)
if service_desk?
params.reject! { |key| key == 'author_username' || key == 'author_id' }
params[:author_id] = ::User.support_bot
options.reject! { |key| key == 'author_username' || key == 'author_id' }
options[:author_id] = ::User.support_bot
end
params
options
end
def service_desk?
......
......@@ -15,7 +15,6 @@ class Groups::EpicsController < Groups::ApplicationController
skip_before_action :labels
def index
set_default_state
@epics = @issuables
respond_to do |format|
......@@ -98,18 +97,7 @@ class Groups::EpicsController < Groups::ApplicationController
@preload_for_collection ||= [:group, :author]
end
# we need to override the default state which is opened for now because we don't have
# states for epics and need all as default for navigation to work correctly (#4017)
def set_default_state
params[:state] = 'opened' if params[:state].blank?
end
def authorize_create_epic!
return render_404 unless can?(current_user, :create_epic, group)
end
def filter_params
set_sort_order_from_cookie
super.merge(start_date: params[:start_date], end_date: params[:end_date])
end
end
......@@ -33,8 +33,8 @@ class Groups::IssuesAnalyticsController < Groups::ApplicationController
IssuesFinder
end
def set_default_state
params[:state] = 'all' if params[:state].blank?
def default_state
'all'
end
def preload_for_collection
......
......@@ -9,8 +9,7 @@ module Groups
def show
# show roadmap for a group
set_sort_order_from_cookie
@sort = params[:sort] || default_sort_order
@sort = set_sort_order_from_cookie || default_sort_order
@epics_count = EpicsFinder.new(current_user, group_id: @group.id).execute.count
end
......
class EpicsFinder < IssuableFinder
def self.scalar_params
@scalar_params ||= %i[
author_id
author_username
label_name
start_date
end_date
search
]
end
def self.array_params
@array_params ||= { label_name: [] }
end
def klass
Epic
end
......
- type = local_assigns.fetch(:type)
- hide_sort_dropdown = local_assigns.fetch(:hide_sort_dropdown, false)
- show_roadmap_presets = local_assigns.fetch(:show_roadmap_presets, false)
- full_path = @project.present? ? @project.full_path : @group.full_path
- preset_layout = roadmap_layout
- is_quarters = preset_layout == "QUARTERS"
- is_months = preset_layout == "MONTHS"
......@@ -31,7 +30,7 @@
dropdown_class: "filtered-search-history-dropdown",
content_class: "filtered-search-history-dropdown-content",
title: "Recent searches" }) do
.js-filtered-search-history-dropdown{ data: { full_path: full_path } }
.js-filtered-search-history-dropdown{ data: { full_path: search_history_storage_prefix } }
.filtered-search-box-input-container.droplab-dropdown
.scroll-container
%ul.tokens-container.list-unstyled
......
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