Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
Add review comments and replies
Sebastian Martinez committed 10 months ago
commit 33b8ecde59f9e83b6f0416861b53dcbe08d48d14
parent b1bcfc7
2 files changed +26 -6
modified src/views/repos/Cob/Revision.svelte
@@ -525,6 +525,12 @@
              </div>
            </CommentComponent>
          </div>
+
          {#if review.threads.length > 0}
+
            {#each review.threads as thread}
+
              <div class="connector"></div>
+
              <Thread {baseUrl} {thread} rawPath={rawPath(revisionBase)} />
+
            {/each}
+
          {/if}
        {/if}
      {/each}
    {/if}
modified src/views/repos/Patch.svelte
@@ -15,8 +15,12 @@
    replies: Comment[];
  }

+
  interface ReviewWithThreads extends Review {
+
    threads: Thread[];
+
  }
+

  interface TimelineReview {
-
    inner: [string, Review];
+
    inner: [string, ReviewWithThreads];
    type: "review";
    timestamp: number;
  }
@@ -186,11 +190,21 @@
      revisionDescription: rev.description,
    },
    [
-
      ...rev.reviews.map<TimelineReview>(review => ({
-
        timestamp: review.timestamp,
-
        type: "review",
-
        inner: [review.author.id, review],
-
      })),
+
      ...rev.reviews.map<TimelineReview>(review => {
+
        const reviewThreads: Thread[] = review.comments
+
          .filter(comment => !comment.replyTo)
+
          .map(thread => ({
+
            root: thread,
+
            replies: review.comments
+
              .filter(comment => comment.replyTo === thread.id)
+
              .sort((a, b) => a.timestamp - b.timestamp),
+
          }));
+
        return {
+
          timestamp: review.timestamp,
+
          type: "review",
+
          inner: [review.author.id, { ...review, threads: reviewThreads }],
+
        };
+
      }),
      ...patch.merges
        .filter(merge => merge.revision === rev.id)
        .map<TimelineMerge>(inner => ({