Renamed DmsfLock.revision to dmsf_file_last_revision_id. #615
This commit is contained in:
parent
c3ae2a35e6
commit
6d2b22c459
@ -0,0 +1,5 @@
|
||||
class AddDmsfFileLastRevisionIdToDmsfLock < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :dmsf_locks, :revision, :dmsf_file_last_revision_id
|
||||
end
|
||||
end
|
||||
@ -69,7 +69,7 @@ module RedmineDmsf
|
||||
l.lock_scope = scope
|
||||
l.user = User.current
|
||||
l.expires_at = expire
|
||||
l.revision = self.last_revision.id if self.is_a?(DmsfFile)
|
||||
l.dmsf_file_last_revision_id = self.last_revision.id if self.is_a?(DmsfFile)
|
||||
l.save!
|
||||
reload
|
||||
locks.reload
|
||||
|
||||
@ -745,7 +745,7 @@ private
|
||||
next if lock.expired?
|
||||
# lock should be exclusive but just in case make sure we find this users lock
|
||||
next if lock.user != User.current
|
||||
if lock.revision < file.last_revision.id
|
||||
if lock.dmsf_file_last_revision_id < file.last_revision.id
|
||||
# At least one new revision has been created since the lock was created, reuse that revision.
|
||||
return true
|
||||
end
|
||||
|
||||
@ -201,7 +201,7 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest
|
||||
assert !User.current.anonymous?, 'Current user is not anonymous'
|
||||
file = DmsfFile.find_file_by_name @project1, nil, 'test.txt'
|
||||
assert l=file.lock!, "File failed to be locked by #{User.current.name}"
|
||||
assert_equal file.last_revision.id, l.revision
|
||||
assert_equal file.last_revision.id, l.dmsf_file_last_revision_id
|
||||
|
||||
# First PUT should always create new revision.
|
||||
assert_difference 'file.dmsf_file_revisions.count', +1 do
|
||||
@ -219,7 +219,7 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest
|
||||
# Lock file again, but this time delete the revision that were stored in the lock
|
||||
file = DmsfFile.find_file_by_name @project1, nil, 'test.txt'
|
||||
assert l=file.lock!, "File failed to be locked by #{User.current.name}"
|
||||
assert_equal file.last_revision.id, l.revision
|
||||
assert_equal file.last_revision.id, l.dmsf_file_last_revision_id
|
||||
|
||||
# Delete the last revision, the revision that were stored in the lock.
|
||||
file.last_revision.delete(true)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user