2018-09-14 01:42:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-06 19:00:48 -05:00
|
|
|
module IssuableCollectionsAction
|
2015-11-17 05:03:18 -05:00
|
|
|
extend ActiveSupport::Concern
|
2016-07-23 19:28:12 -04:00
|
|
|
include IssuableCollections
|
2018-06-12 05:35:34 -04:00
|
|
|
include IssuesCalendar
|
2015-11-17 05:03:18 -05:00
|
|
|
|
2017-11-22 02:50:36 -05:00
|
|
|
# rubocop:disable Gitlab/ModuleWithInstanceVariables
|
2015-11-17 05:03:18 -05:00
|
|
|
def issues
|
2017-11-07 08:34:12 -05:00
|
|
|
@issues = issuables_collection
|
2016-07-23 19:28:12 -04:00
|
|
|
.non_archived
|
|
|
|
.page(params[:page])
|
2016-02-17 08:52:12 -05:00
|
|
|
|
2020-05-27 11:08:11 -04:00
|
|
|
@issuable_meta_data = Gitlab::IssuableMetadata.new(current_user, @issues).data
|
2017-01-23 15:40:25 -05:00
|
|
|
|
2015-11-17 05:03:18 -05:00
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
2017-06-12 13:21:13 -04:00
|
|
|
format.atom { render layout: 'xml.atom' }
|
2015-11-17 05:03:18 -05:00
|
|
|
end
|
|
|
|
end
|
2019-01-06 19:00:48 -05:00
|
|
|
|
|
|
|
def merge_requests
|
|
|
|
@merge_requests = issuables_collection.page(params[:page])
|
|
|
|
|
2020-05-27 11:08:11 -04:00
|
|
|
@issuable_meta_data = Gitlab::IssuableMetadata.new(current_user, @merge_requests).data
|
2019-01-06 19:00:48 -05:00
|
|
|
end
|
2017-11-22 02:50:36 -05:00
|
|
|
# rubocop:enable Gitlab/ModuleWithInstanceVariables
|
2018-02-20 07:33:49 -05:00
|
|
|
|
2018-05-31 10:01:04 -04:00
|
|
|
def issues_calendar
|
2018-06-12 05:35:34 -04:00
|
|
|
render_issues_calendar(issuables_collection)
|
2018-05-31 10:01:04 -04:00
|
|
|
end
|
|
|
|
|
2018-02-20 07:33:49 -05:00
|
|
|
private
|
|
|
|
|
2020-05-06 23:09:46 -04:00
|
|
|
def set_not_query_feature_flag(object = nil)
|
|
|
|
push_frontend_feature_flag(:not_issuable_queries, object, default_enabled: true)
|
|
|
|
end
|
|
|
|
|
2019-08-21 06:13:45 -04:00
|
|
|
def sorting_field
|
2019-01-06 19:00:48 -05:00
|
|
|
case action_name
|
|
|
|
when 'issues'
|
|
|
|
Issue::SORTING_PREFERENCE_FIELD
|
|
|
|
when 'merge_requests'
|
|
|
|
MergeRequest::SORTING_PREFERENCE_FIELD
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-20 07:33:49 -05:00
|
|
|
def finder_type
|
2019-01-06 19:00:48 -05:00
|
|
|
case action_name
|
|
|
|
when 'issues', 'issues_calendar'
|
|
|
|
IssuesFinder
|
|
|
|
when 'merge_requests'
|
|
|
|
MergeRequestsFinder
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def finder_options
|
|
|
|
super.merge(non_archived: true)
|
2018-02-20 07:33:49 -05:00
|
|
|
end
|
2015-11-17 05:03:18 -05:00
|
|
|
end
|