Commit 9db24351 authored by Michal Čihař's avatar Michal Čihař

Update lock time only for owned locks

Issue #983
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 60f18746
......@@ -343,17 +343,21 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
self.save()
def update_lock(self, user):
def update_lock(self, user, create=True):
'''
Updates lock timestamp.
'''
# Check if we can lock
if self.is_user_locked(user):
return
# Update timestamp
if self.is_user_locked():
if self.lock_user == user:
self.update_lock_time()
return
# Auto lock if we should
if appsettings.AUTO_LOCK:
if appsettings.AUTO_LOCK and create:
self.create_lock(user)
return
......
......@@ -37,8 +37,7 @@ from weblate.trans.permissions import (
def update_lock(request, project, subproject, lang):
obj = get_translation(request, project, subproject, lang)
if not obj.is_user_locked(request.user):
obj.update_lock_time()
obj.update_lock(request.user, False)
return HttpResponse('ok')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment