X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cb4f1e62a0c1ef87db0ae60b024e77f6502fe394..f0d7c4a8d6373faa02ed941452ef904ee43ec447:/app/models/changeset.rb diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 8f9a1e69b..3f6df27f6 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -20,6 +20,8 @@ class Changeset < ActiveRecord::Base validates_numericality_of :user_id, :integer_only => true validates_numericality_of :num_changes, :integer_only => true, :greater_than_or_equal_to => 0 + before_save :update_closed_at + # over-expansion factor to use when updating the bounding box EXPAND = 0.1 @@ -191,7 +193,7 @@ class Changeset < ActiveRecord::Base # set the auto-close time to be one hour in the future unless # that would make it more than 24h long, in which case clip to # 24h, as this has been decided is a reasonable time limit. - def before_save + def update_closed_at if self.is_open? if (closed_at - created_at) > (MAX_TIME_OPEN - IDLE_TIMEOUT) self.closed_at = created_at + MAX_TIME_OPEN