diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-19 21:10:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-19 21:10:34 +0300 |
commit | 2f5731cf536deff075d1011814f271cbb1ed67e2 (patch) | |
tree | f6e6dec098a60039b1413dae64d24c0bf55bf03d /app/models/concerns/relative_positioning.rb | |
parent | 74b5b3ffcb9fe4d9424bc2bf35e43f749f76d023 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/relative_positioning.rb')
-rw-r--r-- | app/models/concerns/relative_positioning.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/concerns/relative_positioning.rb b/app/models/concerns/relative_positioning.rb index 3fe8c0fe328..d1f04609693 100644 --- a/app/models/concerns/relative_positioning.rb +++ b/app/models/concerns/relative_positioning.rb @@ -137,9 +137,10 @@ module RelativePositioning # If `true`, then all objects with `null` positions are placed _after_ # all siblings with positions. If `false`, all objects with `null` # positions are placed _before_ all siblings with positions. + # @returns [Number] The number of moved records. def move_nulls(objects, at_end:) objects = objects.reject(&:relative_position) - return if objects.empty? + return 0 if objects.empty? representative = objects.first number_of_gaps = objects.size + 1 # 1 at left, one between each, and one at right @@ -186,6 +187,8 @@ module RelativePositioning end end end + + objects.size end end |