diff options
author | Valery Sizov <valery@gitlab.com> | 2017-02-27 13:52:46 +0200 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-02-27 13:55:06 +0200 |
commit | 6af8547aa21c52e17d7bfc41f396e36d2333df1c (patch) | |
tree | 5b42e4f9ed5bbc930442652b4ff8a79e53761ef6 | |
parent | 34bf798eb85635b7cdc3405ab75955f88be6e157 (diff) | |
download | gitlab-ce-6af8547aa21c52e17d7bfc41f396e36d2333df1c.tar.gz |
[Issue board sorting] Set position for unpositioning issues when view[ci skip]
Actually I think we could avoid doing it so because it does not look efficient.
But we can improve it later.
-rw-r--r-- | app/controllers/projects/boards/issues_controller.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/controllers/projects/boards/issues_controller.rb b/app/controllers/projects/boards/issues_controller.rb index 68437f5729f..70fcc1d60ff 100644 --- a/app/controllers/projects/boards/issues_controller.rb +++ b/app/controllers/projects/boards/issues_controller.rb @@ -8,6 +8,7 @@ module Projects def index issues = ::Boards::Issues::ListService.new(project, current_user, filter_params).execute issues = issues.page(params[:page]).per(params[:per] || 20) + make_sure_position_is_set(issues) render json: { issues: serialize_as_json(issues), @@ -38,6 +39,12 @@ module Projects private + def make_sure_position_is_set(issues) + issues.each do |issue| + issue.move_to_end unless issue.relative_position + end + end + def issue @issue ||= IssuesFinder.new(current_user, project_id: project.id) |