{#each timeline as op}
{#if op.type === "revision"}
{#if op.id === patchId}
opened patch
{formatTimestamp(op.timestamp)}
{:else}
created revision
{formatTimestamp(op.timestamp)}
{/if}
{:else if op.type === "lifecycle"}
{#if op.state.status === "draft"}
converted patch to draft
{:else if op.state.status === "archived"}
archived patch
{:else if op.state.status === "open"}
reopened patch
{/if}
{formatTimestamp(op.timestamp)}
{:else if op.type === "label"}
{#if op.previous && op.previous.type === op.type}
{@const changed = itemDiff(op.previous?.labels ?? [], op.labels)}
{#if changed.added.length || changed.removed.length}
{#if changed.added.length}
added {pluralize("label", changed.added.length)}
{#each changed.added as label}
{label}
{/each}
{/if}
{#if changed.removed.length}
removed {pluralize("label", changed.removed.length)}
{#each changed.removed as label}
{label}
{/each}
{/if}
{/if}
{:else}
added {pluralize("label", op.labels.length)}
{#each op.labels as label}
{label}
{/each}
{/if}
{formatTimestamp(op.timestamp)}
{:else if op.type === "assign"}
{#if op.previous && op.previous.type === op.type}
{@const changed = itemDiff
(
op.previous?.assignees ?? [],
op.assignees,
)}
{#if changed.added.length}
assigned
{#each changed.added as assignee}
{/each}
{/if}
{#if changed.removed.length}
unassigned
{#each changed.removed as assignee}
{/each}
{/if}
{:else}
assigned
{#each op.assignees as assignee}
{/each}
{/if}
{formatTimestamp(op.timestamp)}
{:else if op.type === "merge"}
merged patch at revision
{formatTimestamp(op.timestamp)}
{:else if op.type === "edit"}
{#if op.previous && op.previous.type === op.type}
changed title
{op.previous.title}
-> {op.title}
{formatTimestamp(op.timestamp)}
{/if}
{:else if op.type === "review"}
{#if op.verdict === "accept"}
accepted revision
{formatTimestamp(op.timestamp)}
{:else if op.verdict === "reject"}
rejected revision
{formatTimestamp(op.timestamp)}
{:else if op.verdict === undefined}
reviewed revision
{formatTimestamp(op.timestamp)}
{/if}
{:else if op.type === "review.comment"}
{op.replyTo ? "replied to a comment" : "commented"} on review
{formatTimestamp(op.timestamp)}
{:else if op.type === "revision.comment"}
{op.replyTo ? "replied to a comment" : "commented"} on revision
{formatTimestamp(op.timestamp)}
{/if}
{/each}