Browse Source

Merge pull request #495 from tracim/fix/126/drops_duplicated_revisions_workaround

Bastien Sevajol 6 years ago
parent
commit
20369bc3e8
No account linked to committer's email
1 changed files with 3 additions and 13 deletions
  1. 3 13
      tracim/tracim/model/data.py

+ 3 - 13
tracim/tracim/model/data.py View File

1111
         self._properties = json.dumps(properties_struct)
1111
         self._properties = json.dumps(properties_struct)
1112
         ContentChecker.check_properties(self)
1112
         ContentChecker.check_properties(self)
1113
 
1113
 
1114
-    @property
1115
-    def clean_revisions(self):
1116
-        """
1117
-        This property return revisions with really only one of each revisions:
1118
-        Actually, .revisions list give duplicated last revision,
1119
-        see https://github.com/tracim/tracim/issues/126
1120
-        :return: list of revisions
1121
-        """
1122
-        return list(set(self.revisions))
1123
-
1124
     def created_as_delta(self, delta_from_datetime:datetime=None):
1114
     def created_as_delta(self, delta_from_datetime:datetime=None):
1125
         if not delta_from_datetime:
1115
         if not delta_from_datetime:
1126
             delta_from_datetime = datetime.utcnow()
1116
             delta_from_datetime = datetime.utcnow()
1213
         return last_comment
1203
         return last_comment
1214
 
1204
 
1215
     def get_previous_revision(self) -> 'ContentRevisionRO':
1205
     def get_previous_revision(self) -> 'ContentRevisionRO':
1216
-        rev_ids = [revision.revision_id for revision in self.clean_revisions]
1206
+        rev_ids = [revision.revision_id for revision in self.revisions]
1217
         rev_ids.sort()
1207
         rev_ids.sort()
1218
 
1208
 
1219
         if len(rev_ids)>=2:
1209
         if len(rev_ids)>=2:
1220
             revision_rev_id = rev_ids[-2]
1210
             revision_rev_id = rev_ids[-2]
1221
 
1211
 
1222
-            for revision in self.clean_revisions:
1212
+            for revision in self.revisions:
1223
                 if revision.revision_id == revision_rev_id:
1213
                 if revision.revision_id == revision_rev_id:
1224
                     return revision
1214
                     return revision
1225
 
1215
 
1248
         events = []
1238
         events = []
1249
         for comment in self.get_comments():
1239
         for comment in self.get_comments():
1250
             events.append(VirtualEvent.create_from_content(comment))
1240
             events.append(VirtualEvent.create_from_content(comment))
1251
-        for revision in self.clean_revisions:
1241
+        for revision in self.revisions:
1252
             events.append(VirtualEvent.create_from_content_revision(revision))
1242
             events.append(VirtualEvent.create_from_content_revision(revision))
1253
 
1243
 
1254
         sorted_events = sorted(events,
1244
         sorted_events = sorted(events,