Refactor create element consistency check

This commit is contained in:
Anton Khorev 2024-03-30 10:09:55 +03:00
parent 50df5eefcc
commit f50ca826aa
4 changed files with 79 additions and 7 deletions

View file

@ -23,13 +23,7 @@ module ConsistencyValidations
# This is similar to above, just some validations don't apply
def check_create_consistency(new, user)
if new.changeset.nil?
raise OSM::APIChangesetMissingError
elsif new.changeset.user_id != user.id
raise OSM::APIUserChangesetMismatchError
elsif !new.changeset.open?
raise OSM::APIChangesetAlreadyClosedError, new.changeset
end
check_changeset_consistency(new.changeset, user)
end
##