Repository: translate/pootle

Issue:
Remove translator_comment from suggestion
not clear if this is a historical artefact but suggestion has a translator_comment field which afaict isnt used


Discussion:

Resolving patch:
diff --git a/pootle/apps/pootle_store/abstracts.py b/pootle/apps/pootle_store/abstracts.py
--- a/pootle/apps/pootle_store/abstracts.py
+++ b/pootle/apps/pootle_store/abstracts.py
@@ -293,8 +293,6 @@ class Meta(object):
         db_index=True,
         on_delete=models.SET(get_system_user))
 
-    translator_comment_f = models.TextField(null=True, blank=True)
-
     creation_time = models.DateTimeField(db_index=True, null=True)
     review_time = models.DateTimeField(null=True, db_index=True)
 
diff --git a/pootle/apps/pootle_store/migrations/0031_remove_suggestion_translator_comment_f.py b/pootle/apps/pootle_store/migrations/0031_remove_suggestion_translator_comment_f.py
new file mode 100644
--- /dev/null
+++ b/pootle/apps/pootle_store/migrations/0031_remove_suggestion_translator_comment_f.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-07-04 07:42
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('pootle_store', '0030_remove_extra_indeces'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='suggestion',
+            name='translator_comment_f',
+        ),
+    ]
diff --git a/pootle/apps/pootle_store/models.py b/pootle/apps/pootle_store/models.py
--- a/pootle/apps/pootle_store/models.py
+++ b/pootle/apps/pootle_store/models.py
@@ -34,7 +34,7 @@
     get_editor_filter, split_pootle_path, to_tp_relative_path)
 from pootle.core.utils import dateformat
 from pootle.core.utils.aggregate import max_column
-from pootle.core.utils.multistring import PLURAL_PLACEHOLDER, SEPARATOR
+from pootle.core.utils.multistring import PLURAL_PLACEHOLDER
 from pootle.core.utils.timezone import datetime_min, make_aware
 from pootle_checks.constants import CHECK_NAMES
 from pootle_statistics.models import SubmissionFields, SubmissionTypes
@@ -135,34 +135,17 @@ def _target(self):
     @_target.setter
     def _target(self, value):
         self.target_f = value
-        self._set_hash()
+        self.target_hash = md5(force_bytes(self.target_f)).hexdigest()
 
     @property
     def _source(self):
         return self.unit._source
 
-    @property
-    def translator_comment(self):
-        return self.translator_comment_f
-
-    @translator_comment.setter
-    def translator_comment(self, value):
-        self.translator_comment_f = value
-        self._set_hash()
-
     # # # # # # # # # # # # # #  Methods # # # # # # # # # # # # # # # # # # #
 
     def __unicode__(self):
         return unicode(self.target)
 
-    def _set_hash(self):
-        string = self.translator_comment_f
-        if string:
-            string = self.target_f + SEPARATOR + string
-        else:
-            string = self.target_f
-        self.target_hash = md5(force_bytes(string)).hexdigest()
-
 
 # # # # # # # # Unit # # # # # # # # # #
 


Test patch:
diff --git a/tests/models/suggestion.py b/tests/models/suggestion.py
--- a/tests/models/suggestion.py
+++ b/tests/models/suggestion.py
@@ -21,15 +21,11 @@ def test_hash(store0):
     suggestions = review.get(Suggestion)()
 
     suggestion, created_ = suggestions.add(unit, "gras")
-
     first_hash = suggestion.target_hash
-    suggestion.translator_comment = "my nice comment"
+    suggestion.target = "gras++"
     second_hash = suggestion.target_hash
     assert first_hash != second_hash
 
-    suggestion.target = "gras++"
-    assert first_hash != second_hash != suggestion.target_hash
-
 
 @pytest.mark.django_db
 def test_accept_suggestion_with_comment_email_escaped(store0, mailoutbox):