|
@@ -507,7 +507,7 @@ class RevisionInContext(object):
|
507
|
507
|
|
508
|
508
|
@property
|
509
|
509
|
def created(self):
|
510
|
|
- return self.revision.created
|
|
510
|
+ return self.updated
|
511
|
511
|
|
512
|
512
|
@property
|
513
|
513
|
def modified(self):
|
|
@@ -518,9 +518,51 @@ class RevisionInContext(object):
|
518
|
518
|
return self.revision.updated
|
519
|
519
|
|
520
|
520
|
@property
|
|
521
|
+ def next_revision(self):
|
|
522
|
+ next_revision = None
|
|
523
|
+ revisions = self.revision.node.revisions
|
|
524
|
+ # INFO - G.M - 2018-06-177 - Get revisions more recent that
|
|
525
|
+ # current one
|
|
526
|
+ next_revisions = [
|
|
527
|
+ revision for revision in revisions
|
|
528
|
+ if revision.revision_id > self.revision.revision_id
|
|
529
|
+ ]
|
|
530
|
+ if next_revisions:
|
|
531
|
+ # INFO - G.M - 2018-06-177 -sort revisions by date
|
|
532
|
+ sorted_next_revisions = sorted(
|
|
533
|
+ next_revisions,
|
|
534
|
+ key=lambda revision: revision.updated
|
|
535
|
+ )
|
|
536
|
+ # INFO - G.M - 2018-06-177 - return only next revision
|
|
537
|
+ return sorted_next_revisions[0]
|
|
538
|
+ else:
|
|
539
|
+ return None
|
|
540
|
+
|
|
541
|
+ @property
|
521
|
542
|
def comments_ids(self):
|
522
|
|
- # TODO - G.M - 2018-06-173 - Return comments related to this revision
|
523
|
|
- return []
|
|
543
|
+ comments = self.revision.node.get_comments()
|
|
544
|
+ # INFO - G.M - 2018-06-177 - Get comments more recent than revision.
|
|
545
|
+ revisions_comments = [
|
|
546
|
+ comment for comment in comments
|
|
547
|
+ if comment.created > self.revision.updated
|
|
548
|
+ ]
|
|
549
|
+ if self.next_revision:
|
|
550
|
+ # INFO - G.M - 2018-06-177 - if there is a revision more recent
|
|
551
|
+ # than current remove comments from theses rev (comments older
|
|
552
|
+ # than next_revision.)
|
|
553
|
+ revisions_comments = [
|
|
554
|
+ comment for comment in revisions_comments
|
|
555
|
+ if comment.created < self.next_revision.updated
|
|
556
|
+ ]
|
|
557
|
+ sorted_revision_comments = sorted(
|
|
558
|
+ revisions_comments,
|
|
559
|
+ key=lambda revision: revision.created
|
|
560
|
+ )
|
|
561
|
+ comments_id = [
|
|
562
|
+ comments.content_id
|
|
563
|
+ for comments in sorted_revision_comments
|
|
564
|
+ ]
|
|
565
|
+ return comments_id
|
524
|
566
|
|
525
|
567
|
# Context-related
|
526
|
568
|
@property
|