forked from coracle/flotilla
avoid forking conversations when tagging someone
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {onMount} from "svelte"
|
import {onMount} from "svelte"
|
||||||
import {derived} from "svelte/store"
|
import {derived} from "svelte/store"
|
||||||
import {int, MINUTE, sortBy, remove} from "@welshman/lib"
|
import {int, nthNe, MINUTE, sortBy, remove} from "@welshman/lib"
|
||||||
import type {TrustedEvent, EventContent} from "@welshman/util"
|
import type {TrustedEvent, EventContent} from "@welshman/util"
|
||||||
import {createEvent, DIRECT_MESSAGE, INBOX_RELAYS} from "@welshman/util"
|
import {createEvent, DIRECT_MESSAGE, INBOX_RELAYS} from "@welshman/util"
|
||||||
import {
|
import {
|
||||||
@@ -53,7 +53,8 @@
|
|||||||
pushModal(ProfileList, {pubkeys: others, title: `People in this conversation`})
|
pushModal(ProfileList, {pubkeys: others, title: `People in this conversation`})
|
||||||
|
|
||||||
const onSubmit = async ({content, ...params}: EventContent) => {
|
const onSubmit = async ({content, ...params}: EventContent) => {
|
||||||
const tags = [...params.tags, ...remove($pubkey!, pubkeys).map(tagPubkey)]
|
// Remove p tags since they result in forking the conversation
|
||||||
|
const tags = [...params.tags.filter(nthNe(0, "p")), ...remove($pubkey!, pubkeys).map(tagPubkey)]
|
||||||
|
|
||||||
await sendWrapped({
|
await sendWrapped({
|
||||||
pubkeys,
|
pubkeys,
|
||||||
@@ -129,8 +130,10 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button on:click={showMembers} class="btn btn-link hidden sm:block"
|
{#if others.length > 2}
|
||||||
>Show all members</Button>
|
<Button on:click={showMembers} class="btn btn-link hidden sm:block"
|
||||||
|
>Show all members</Button>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div slot="action">
|
<div slot="action">
|
||||||
|
|||||||
@@ -38,22 +38,23 @@
|
|||||||
<span class="loading loading-spinner" />
|
<span class="loading loading-spinner" />
|
||||||
</div>
|
</div>
|
||||||
{:then preview}
|
{:then preview}
|
||||||
<div class="bg-alt flex flex-col max-w-xl leading-normal">
|
<div class="bg-alt flex max-w-xl flex-col leading-normal">
|
||||||
{#if preview.image}
|
{#if preview.image}
|
||||||
<img
|
<img
|
||||||
alt="Link preview"
|
alt="Link preview"
|
||||||
src={imgproxy(preview.image)}
|
src={imgproxy(preview.image)}
|
||||||
class="max-h-72 object-contain object-center bg-alt" />
|
class="bg-alt max-h-72 object-contain object-center" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if preview.title}
|
{#if preview.title}
|
||||||
<div class="flex flex-col gap-2 p-4">
|
<div class="flex flex-col gap-2 p-4">
|
||||||
<strong class="overflow-hidden text-ellipsis whitespace-nowrap">{preview.title}</strong>
|
<strong class="overflow-hidden text-ellipsis whitespace-nowrap"
|
||||||
|
>{preview.title}</strong>
|
||||||
<p>{ellipsize(preview.description, 140)}</p>
|
<p>{ellipsize(preview.description, 140)}</p>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{:catch}
|
{:catch}
|
||||||
<p class="p-12 text-center bg-alt">
|
<p class="bg-alt p-12 text-center">
|
||||||
Unable to load a preview for {url}
|
Unable to load a preview for {url}
|
||||||
</p>
|
</p>
|
||||||
{/await}
|
{/await}
|
||||||
|
|||||||
Reference in New Issue
Block a user