diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-25 12:10:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-25 12:10:45 +0300 |
commit | bcfab67c0f33aeda96041f341f92cf0ff1e062d3 (patch) | |
tree | 2d3a9c5ccd7693112ed48d410a9a940f6a1fa8de /app/services/boards | |
parent | c1ccb69fc9b1f07a00d3310f5fbd2e4622db9482 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/boards')
-rw-r--r-- | app/services/boards/base_items_list_service.rb | 16 | ||||
-rw-r--r-- | app/services/boards/issues/list_service.rb | 16 |
2 files changed, 16 insertions, 16 deletions
diff --git a/app/services/boards/base_items_list_service.rb b/app/services/boards/base_items_list_service.rb index 851120ef597..5aebf216460 100644 --- a/app/services/boards/base_items_list_service.rb +++ b/app/services/boards/base_items_list_service.rb @@ -11,8 +11,24 @@ module Boards ordered_items end + # rubocop: disable CodeReuse/ActiveRecord + def metadata + issuables = item_model.arel_table + keys = metadata_fields.keys + # TODO: eliminate need for SQL literal fragment + columns = Arel.sql(metadata_fields.values_at(*keys).join(', ')) + results = item_model.where(id: items.select(issuables[:id])).pluck(columns) + + Hash[keys.zip(results.flatten)] + end + # rubocop: enable CodeReuse/ActiveRecord + private + def metadata_fields + { size: 'COUNT(*)' } + end + def ordered_items raise NotImplementedError end diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index 27d59e052c7..c6855f29af0 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -9,18 +9,6 @@ module Boards IssuesFinder.valid_params end - # rubocop: disable CodeReuse/ActiveRecord - def metadata - issues = Issue.arel_table - keys = metadata_fields.keys - # TODO: eliminate need for SQL literal fragment - columns = Arel.sql(metadata_fields.values_at(*keys).join(', ')) - results = Issue.where(id: items.select(issues[:id])).pluck(columns) - - Hash[keys.zip(results.flatten)] - end - # rubocop: enable CodeReuse/ActiveRecord - private def ordered_items @@ -35,10 +23,6 @@ module Boards @board ||= parent.boards.find(params[:board_id]) end - def metadata_fields - { size: 'COUNT(*)' } - end - def filter_params set_scope set_non_archived |