Commit 08f88b9e authored by Michal Čihař's avatar Michal Čihař

Log found duplicate strings

Issue #693
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent f208e79f
......@@ -150,6 +150,7 @@ class Change(models.Model):
ACTION_NEW_SOURCE = 13
ACTION_LOCK = 14
ACTION_UNLOCK = 15
ACTION_FOUND_DUPLICATE = 16
ACTION_CHOICES = (
(ACTION_UPDATE, ugettext_lazy('Resource update')),
......@@ -168,6 +169,7 @@ class Change(models.Model):
(ACTION_NEW_SOURCE, ugettext_lazy('New source string')),
(ACTION_LOCK, ugettext_lazy('Component locked')),
(ACTION_UNLOCK, ugettext_lazy('Component unlocked')),
(ACTION_FOUND_DUPLICATE, ugettext_lazy('Detected duplicate string')),
)
unit = models.ForeignKey('Unit', null=True)
......
......@@ -460,6 +460,10 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
if change is None:
change = Change.ACTION_UPDATE
if request is None:
user = None
else:
user = request.user
# Check if we're not already up to date
if self.revision != self.get_git_blob_hash():
......@@ -512,6 +516,13 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
newunit,
repr(newunit.source)
)
Change.object.create(
unit=newunit,
translation=self,
action=Change.ACTION_FOUND_DUPLICATE,
user=user,
author=user
)
# Store current unit ID
created_units.add(newunit.id)
......@@ -540,10 +551,6 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
self.invalidate_cache()
# Store change entry
if request is None:
user = None
else:
user = request.user
Change.objects.create(
translation=self,
action=change,
......
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