diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2018-07-30 13:44:41 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-07-30 13:44:41 +0000 |
commit | 5815c5b48ac03dbd89a239e87c0f49216a428563 (patch) | |
tree | 7af892c202f2e00ee79d2646d5429ee466ff3ded /app/controllers/boards/issues_controller.rb | |
parent | 4f08343463d6a987ad3415d410b38b4f9dde67a2 (diff) | |
download | gitlab-ce-5815c5b48ac03dbd89a239e87c0f49216a428563.tar.gz |
[Backport] View summed weights of issues in board column
Diffstat (limited to 'app/controllers/boards/issues_controller.rb')
-rw-r--r-- | app/controllers/boards/issues_controller.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/controllers/boards/issues_controller.rb b/app/controllers/boards/issues_controller.rb index 09e143c23e8..7dd19f87ef5 100644 --- a/app/controllers/boards/issues_controller.rb +++ b/app/controllers/boards/issues_controller.rb @@ -12,8 +12,9 @@ module Boards skip_before_action :authenticate_user!, only: [:index] def index - issues = Boards::Issues::ListService.new(board_parent, current_user, filter_params).execute - issues = issues.page(params[:page]).per(params[:per] || 20) + list_service = Boards::Issues::ListService.new(board_parent, current_user, filter_params) + issues = list_service.execute + issues = issues.page(params[:page]).per(params[:per] || 20).without_count make_sure_position_is_set(issues) if Gitlab::Database.read_write? issues = issues.preload(:project, :milestone, @@ -22,10 +23,7 @@ module Boards notes: [:award_emoji, :author] ) - render json: { - issues: serialize_as_json(issues), - size: issues.total_count - } + render_issues(issues, list_service.metadata) end def create @@ -51,6 +49,13 @@ module Boards private + def render_issues(issues, metadata) + data = { issues: serialize_as_json(issues) } + data.merge!(metadata) + + render json: data + end + def make_sure_position_is_set(issues) issues.each do |issue| issue.move_to_end && issue.save unless issue.relative_position |