Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add `alias` to `Comment`
xphoniex committed 3 years ago
commit 305c9677fd1ad9b6915b0aee1f793949d89de125
parent 3eab5b9d62a1c8083141bcf9b069eb2370eb1e2a
3 files changed +6 -3
modified httpd-client/lib/project/comment.ts
@@ -14,7 +14,7 @@ export type ThreadUpdateAction =

export interface Comment {
  id: string;
-
  author: { id: string };
+
  author: { id: string; alias?: string };
  body: string;
  reactions: Record<string, number>[];
  timestamp: number;
@@ -23,7 +23,7 @@ export interface Comment {

export const commentSchema = strictObject({
  id: string(),
-
  author: strictObject({ id: string() }),
+
  author: strictObject({ id: string(), alias: string().optional() }),
  body: string(),
  reactions: array(record(string(), number())),
  timestamp: number(),
modified src/components/Comment.svelte
@@ -8,6 +8,7 @@

  export let id: string | undefined = undefined;
  export let authorId: string;
+
  export let authorAlias: string | undefined = undefined;
  export let timestamp: number;
  export let body: string;
  export let showReplyIcon: boolean = false;
@@ -51,7 +52,7 @@
<div class="comment" {id}>
  <div class="card">
    <div class="card-header">
-
      <Authorship {caption} {authorId} {timestamp} />
+
      <Authorship {caption} {authorId} {authorAlias} {timestamp} />
      <div class="actions">
        {#if showReplyIcon}
          <Button
modified src/components/Thread.svelte
@@ -67,6 +67,7 @@
    {rawPath}
    id={root.id}
    authorId={root.author.id}
+
    authorAlias={root.author.alias}
    timestamp={root.timestamp}
    body={root.body}
    showReplyIcon={Boolean($sessionStore)}
@@ -78,6 +79,7 @@
      {rawPath}
      id={reply.id}
      authorId={reply.author.id}
+
      authorAlias={reply.author.alias}
      timestamp={reply.timestamp}
      body={reply.body} />
  </div>