<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -98,16 +98,18 @@ def filter_by_suggester(query, store, item, suggitem):
     except PootleProfile.DoesNotExist:
         return query
 
+def get_pending_unit(store, item, newtrans):
+    return Unit.objects.get(store  = store,
+                            index  = item,
+                            source = store.file.getitem(item).getsource(),
+                            target = newtrans,
+                            state  = 'pending')
+
 def get_suggestion(store, item, newtrans, request):
     &quot;&quot;&quot;Marks the suggestion specified by the parameters with the given status,
     and returns that suggestion object&quot;&quot;&quot;
     translation_project = request.translation_project
-    unit  = Unit.objects.get(store  = store,
-                             index  = item,
-                             source = store.file.getitem(item).getsource(),
-                             target = newtrans,
-                             state  = 'pending'
-                             )
+    unit = get_pending_unit(store, item, newtrans)
     return Suggestion.objects.get(translation_project = translation_project,
                                   unit                = unit)
 
@@ -122,6 +124,11 @@ def reject_suggestion(store, item, suggitem, newtrans, request):
         # Deletes the suggestion from the database
         suggestion = get_suggestion(store, item, newtrans, request)
         suggestion.delete()
+        # We also need to delete the Unit object.
+        # Yes, this is a little bit confusing, as noted above, maybe
+        # we should get rid of the Unit model.
+        unit = get_pending_unit(store, item, newtrans)
+        unit.delete()
     except ObjectDoesNotExist:
         pass
     # Deletes the suggestion from the .pending file</diff>
      <filename>local_apps/pootle_app/unit_update.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bcb44faaa9280e447596aed3054bd7655d2b21d9</id>
    </parent>
  </parents>
  <author>
    <name>murgilduta</name>
    <email>murgilduta@54714841-351b-0410-a198-e36a94b762f5</email>
  </author>
  <url>http://github.com/translateorgza/pootle/commit/743c8eb511bc25bdcef36191d2a5aca92eb2b25e</url>
  <id>743c8eb511bc25bdcef36191d2a5aca92eb2b25e</id>
  <committed-date>2009-10-13T11:23:03-07:00</committed-date>
  <authored-date>2009-10-13T11:23:03-07:00</authored-date>
  <message>Allow to suggest already reviewed target strings.

When deleting a suggestion, we also need to delete the Unit object
that has a 'pending' state. Otherwise it is kept in the DB so when
making a new suggestion it matches an existing Unit object, and
thus the new suggestion is not stored.

This fixes bug 1149.

git-svn-id: https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/Pootle@12376 54714841-351b-0410-a198-e36a94b762f5</message>
  <tree>7f2437d1e8e8a3137e764984114a6c100c83a5c9</tree>
  <committer>
    <name>murgilduta</name>
    <email>murgilduta@54714841-351b-0410-a198-e36a94b762f5</email>
  </committer>
</commit>
