other discussions.

This commit is contained in:
Jason Schwarzenberger 2020-11-27 14:04:58 +13:00
parent da62f8859b
commit deeb1d4649

View File

@ -19,6 +19,7 @@
export let story; export let story;
export let related; export let related;
let others = related.filter((r) => r.id !== story.id && r.num_comments);
let hasComments = related.some((r) => r.num_comments); let hasComments = related.some((r) => r.num_comments);
</script> </script>
@ -80,11 +81,11 @@
{#if hasComments} {#if hasComments}
<hr class="spacer" /> <hr class="spacer" />
<h2 id="comments">Comments</h2> <h2 id="comments">Comments</h2>
{#if related.length} {#if others.length}
<h3> <h3>
Other discussions: Other discussions:
{#each related as r} {#each others as r}
{#if r.num_comments && r.id !== story.id} {#if r.num_comments}
<a href="/{r.id}#comments" rel="prefetch">{r.source}</a> <a href="/{r.id}#comments" rel="prefetch">{r.source}</a>
{/if} {/if}
{/each} {/each}