]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/concerns/consistency_validations.rb
Refactor create element consistency check
[rails.git] / app / models / concerns / consistency_validations.rb
index 101fd43103955a024eb57c676ff69a3f356bffc8..97b6743ebc80752b1a5f9e9ef0f7b8f2592dc7fc 100644 (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
 
   ##