summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2019-08-01 12:41:42 +0000
committerBob Van Landuyt <bob@gitlab.com>2019-08-01 12:41:42 +0000
commitfc09bb0770ab74572cb2cf706180dce7503e19a0 (patch)
tree7c5a3d6c0a6f51f515da5868b8c485be73b2d436 /app
parentbeb7d8922746942f1f4108108b04859ba61ea1ea (diff)
parent8992013689e358328d9ae74623b9b29d80f7b17b (diff)
downloadgitlab-ce-fc09bb0770ab74572cb2cf706180dce7503e19a0.tar.gz
Merge branch 'rename-relative-position-move-to-end' into 'master'
Fix bug when moving batches of items to the end See merge request gitlab-org/gitlab-ce!31351
Diffstat (limited to 'app')
-rw-r--r--app/controllers/boards/issues_controller.rb2
-rw-r--r--app/models/concerns/relative_positioning.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/boards/issues_controller.rb b/app/controllers/boards/issues_controller.rb
index 90528f75ffd..1d1a72d21f1 100644
--- a/app/controllers/boards/issues_controller.rb
+++ b/app/controllers/boards/issues_controller.rb
@@ -26,7 +26,7 @@ module Boards
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
- Issue.move_to_end(issues) if Gitlab::Database.read_write?
+ Issue.move_nulls_to_end(issues) if Gitlab::Database.read_write?
issues = issues.preload(:milestone,
:assignees,
project: [
diff --git a/app/models/concerns/relative_positioning.rb b/app/models/concerns/relative_positioning.rb
index 9cd7b8d6258..4a1441805fc 100644
--- a/app/models/concerns/relative_positioning.rb
+++ b/app/models/concerns/relative_positioning.rb
@@ -34,7 +34,7 @@ module RelativePositioning
end
class_methods do
- def move_to_end(objects)
+ def move_nulls_to_end(objects)
objects = objects.reject(&:relative_position)
return if objects.empty?
@@ -43,7 +43,7 @@ module RelativePositioning
self.transaction do
objects.each do |object|
- relative_position = position_between(max_relative_position, MAX_POSITION)
+ relative_position = position_between(max_relative_position || START_POSITION, MAX_POSITION)
object.relative_position = relative_position
max_relative_position = relative_position
object.save(touch: false)