Merge pull request #2664 from urbanrotnik/ur-sci-4762-v2

Canvas fix [SCI-4762] -v2
This commit is contained in:
aignatov-bio 2020-06-17 13:01:40 +02:00 committed by GitHub
commit d0f0baf6b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,7 +60,6 @@ class CanvasController < ApplicationController
positions = {}
if update_params[:positions].present?
poss = update_params[:positions].split(';')
center = ''
(poss.collect { |pos| pos.split(',') }).each_with_index do |pos, index|
unless pos.length == 3 && pos[0].is_a?(String) &&
float?(pos[1]) && float?(pos[2])
@ -68,8 +67,7 @@ class CanvasController < ApplicationController
end
x = pos[1].to_i
y = pos[2].to_i
# Multiple modules cannot have same position
return render_403 if positions.any? { |_, v| v[:x] == x && v[:y] == y }
positions[pos[0]] = { x: x, y: y }
end
end