mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 10:57:04 +00:00
Rename reply to comment
This commit is contained in:
@@ -46,7 +46,7 @@ import {
|
|||||||
loadRelay,
|
loadRelay,
|
||||||
} from "@welshman/app"
|
} from "@welshman/app"
|
||||||
import {
|
import {
|
||||||
REPLY,
|
COMMENT,
|
||||||
tagRoom,
|
tagRoom,
|
||||||
userMembership,
|
userMembership,
|
||||||
MEMBERSHIPS,
|
MEMBERSHIPS,
|
||||||
@@ -320,7 +320,7 @@ export type ReplyParams = {
|
|||||||
tags?: string[][]
|
tags?: string[][]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeReply = ({event, content, tags = []}: ReplyParams) => {
|
export const makeComment = ({event, content, tags = []}: ReplyParams) => {
|
||||||
const seenRoots = new Set<string>()
|
const seenRoots = new Set<string>()
|
||||||
|
|
||||||
for (const [raw, ...tag] of event.tags.filter(t => t[0].match(/^K|E|A|I$/i))) {
|
for (const [raw, ...tag] of event.tags.filter(t => t[0].match(/^K|E|A|I$/i))) {
|
||||||
@@ -343,11 +343,11 @@ export const makeReply = ({event, content, tags = []}: ReplyParams) => {
|
|||||||
tags.push(["e", event.id])
|
tags.push(["e", event.id])
|
||||||
}
|
}
|
||||||
|
|
||||||
return createEvent(REPLY, {content, tags})
|
return createEvent(COMMENT, {content, tags})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const publishReply = ({relays, ...params}: ReplyParams & {relays: string[]}) =>
|
export const publishComment = ({relays, ...params}: ReplyParams & {relays: string[]}) =>
|
||||||
publishThunk({event: makeReply(params), relays})
|
publishThunk({event: makeComment(params), relays})
|
||||||
|
|
||||||
export const makeDelete = ({event}: {event: TrustedEvent}) =>
|
export const makeDelete = ({event}: {event: TrustedEvent}) =>
|
||||||
createEvent(DELETE, {tags: [["k", String(event.kind)], ...tagEvent(event)]})
|
createEvent(DELETE, {tags: [["k", String(event.kind)], ...tagEvent(event)]})
|
||||||
|
|||||||
@@ -7,19 +7,19 @@
|
|||||||
import {deriveEvents} from "@welshman/store"
|
import {deriveEvents} from "@welshman/store"
|
||||||
import ChannelMessage from "@app/components/ChannelMessage.svelte"
|
import ChannelMessage from "@app/components/ChannelMessage.svelte"
|
||||||
import ChannelCompose from "@app/components/ChannelCompose.svelte"
|
import ChannelCompose from "@app/components/ChannelCompose.svelte"
|
||||||
import {tagRoom, REPLY} from "@app/state"
|
import {tagRoom, COMMENT} from "@app/state"
|
||||||
import {publishReply} from "@app/commands"
|
import {publishComment} from "@app/commands"
|
||||||
|
|
||||||
export let url, room, event: TrustedEvent
|
export let url, room, event: TrustedEvent
|
||||||
|
|
||||||
const thunks = writable({} as Record<string, Thunk>)
|
const thunks = writable({} as Record<string, Thunk>)
|
||||||
|
|
||||||
const replies = deriveEvents(repository, {
|
const replies = deriveEvents(repository, {
|
||||||
filters: [{kinds: [REPLY], "#E": [event.id]}],
|
filters: [{kinds: [COMMENT], "#E": [event.id]}],
|
||||||
})
|
})
|
||||||
|
|
||||||
const onSubmit = ({content, tags}: EventContent) => {
|
const onSubmit = ({content, tags}: EventContent) => {
|
||||||
const thunk = publishReply({
|
const thunk = publishComment({
|
||||||
event,
|
event,
|
||||||
content,
|
content,
|
||||||
tags: append(tagRoom(room, url), tags),
|
tags: append(tagRoom(room, url), tags),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import Link from "@lib/components/Link.svelte"
|
import Link from "@lib/components/Link.svelte"
|
||||||
import Spinner from "@lib/components/Spinner.svelte"
|
import Spinner from "@lib/components/Spinner.svelte"
|
||||||
import NoteCard from "@app/components/NoteCard.svelte"
|
import NoteCard from "@app/components/NoteCard.svelte"
|
||||||
import {deriveEvent, entityLink, userMembership, getMembershipUrls, REPLY} from "@app/state"
|
import {deriveEvent, entityLink, userMembership, getMembershipUrls, COMMENT} from "@app/state"
|
||||||
import {makeThreadPath} from "@app/routes"
|
import {makeThreadPath} from "@app/routes"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
// If we found this event on a relay that the user is a member of, redirect internally
|
// If we found this event on a relay that the user is a member of, redirect internally
|
||||||
$: url = getMembershipUrls($userMembership).find(url => $trackerStore.hasRelay($event?.id, url))
|
$: url = getMembershipUrls($userMembership).find(url => $trackerStore.hasRelay($event?.id, url))
|
||||||
$: root = $event?.kind === REPLY ? $event.tags.find(nthEq(0, "E"))?.[1] : $event?.id
|
$: root = $event?.kind === COMMENT ? $event.tags.find(nthEq(0, "E"))?.[1] : $event?.id
|
||||||
$: href = url && root ? makeThreadPath(url, root) : entityLink(entity)
|
$: href = url && root ? makeThreadPath(url, root) : entityLink(entity)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
import {deriveEvents} from "@welshman/store"
|
import {deriveEvents} from "@welshman/store"
|
||||||
import {repository} from "@welshman/app"
|
import {repository} from "@welshman/app"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import {REPLY} from "@app/state"
|
import {COMMENT} from "@app/state"
|
||||||
|
|
||||||
export let event
|
export let event
|
||||||
|
|
||||||
const replies = deriveEvents(repository, {filters: [{kinds: [REPLY], "#E": [event.id]}]})
|
const replies = deriveEvents(repository, {filters: [{kinds: [COMMENT], "#E": [event.id]}]})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $replies.length > 0}
|
{#if $replies.length > 0}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
||||||
import ThreadMenu from "@app/components/ThreadMenu.svelte"
|
import ThreadMenu from "@app/components/ThreadMenu.svelte"
|
||||||
import {publishDelete, publishReaction} from "@app/commands"
|
import {publishDelete, publishReaction} from "@app/commands"
|
||||||
import {REPLY} from "@app/state"
|
import {COMMENT} from "@app/state"
|
||||||
|
|
||||||
export let url
|
export let url
|
||||||
export let event
|
export let event
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
const deleted = deriveIsDeleted(repository, event)
|
const deleted = deriveIsDeleted(repository, event)
|
||||||
|
|
||||||
const replies = deriveEvents(repository, {filters: [{kinds: [REPLY], "#E": [event.id]}]})
|
const replies = deriveEvents(repository, {filters: [{kinds: [COMMENT], "#E": [event.id]}]})
|
||||||
|
|
||||||
const showPopover = () => popover.show()
|
const showPopover = () => popover.show()
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
import ThreadShare from "@app/components/ThreadShare.svelte"
|
import ThreadShare from "@app/components/ThreadShare.svelte"
|
||||||
import {publishDelete} from "@app/commands"
|
import {publishDelete} from "@app/commands"
|
||||||
import {pushModal} from "@app/modal"
|
import {pushModal} from "@app/modal"
|
||||||
import {REPLY} from "@app/state"
|
import {COMMENT} from "@app/state"
|
||||||
|
|
||||||
export let url
|
export let url
|
||||||
export let event
|
export let event
|
||||||
export let onClick
|
export let onClick
|
||||||
|
|
||||||
const isRoot = event.kind !== REPLY
|
const isRoot = event.kind !== COMMENT
|
||||||
|
|
||||||
const showInfo = () => {
|
const showInfo = () => {
|
||||||
onClick()
|
onClick()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import {getPubkeyHints, publishReply} from "@app/commands"
|
import {getPubkeyHints, publishComment} from "@app/commands"
|
||||||
import {getEditorOptions, addFile, uploadFiles, getEditorTags} from "@lib/editor"
|
import {getEditorOptions, addFile, uploadFiles, getEditorTags} from "@lib/editor"
|
||||||
import {pushToast} from '@app/toast'
|
import {pushToast} from '@app/toast'
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(publishReply({event, content, tags, relays: [url]}))
|
onSubmit(publishComment({event, content, tags, relays: [url]}))
|
||||||
}
|
}
|
||||||
|
|
||||||
let editor: Readable<Editor>
|
let editor: Readable<Editor>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export const GENERAL = "general"
|
|||||||
|
|
||||||
export const MESSAGE = 209
|
export const MESSAGE = 209
|
||||||
|
|
||||||
export const REPLY = 1111
|
export const COMMENT = 1111
|
||||||
|
|
||||||
export const MEMBERSHIPS = 10209
|
export const MEMBERSHIPS = 10209
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ export const readMessage = (event: TrustedEvent): Maybe<ChannelMessage> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const channelMessages = deriveEventsMapped<ChannelMessage>(repository, {
|
export const channelMessages = deriveEventsMapped<ChannelMessage>(repository, {
|
||||||
filters: [{kinds: [MESSAGE, REPLY]}],
|
filters: [{kinds: [MESSAGE, COMMENT]}],
|
||||||
eventToItem: readMessage,
|
eventToItem: readMessage,
|
||||||
itemToEvent: item => item.event,
|
itemToEvent: item => item.event,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
import Delay from "@lib/components/Delay.svelte"
|
import Delay from "@lib/components/Delay.svelte"
|
||||||
import SecondaryNav from "@lib/components/SecondaryNav.svelte"
|
import SecondaryNav from "@lib/components/SecondaryNav.svelte"
|
||||||
import MenuSpace from "@app/components/MenuSpace.svelte"
|
import MenuSpace from "@app/components/MenuSpace.svelte"
|
||||||
import {decodeRelay, MEMBERSHIPS, MESSAGE, REPLY} from "@app/state"
|
import {decodeRelay, MEMBERSHIPS, MESSAGE, COMMENT} from "@app/state"
|
||||||
|
|
||||||
$: url = decodeRelay($page.params.relay)
|
$: url = decodeRelay($page.params.relay)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const sub = subscribe({
|
const sub = subscribe({
|
||||||
filters: [
|
filters: [
|
||||||
{kinds: [DELETE], "#k": [NOTE, REPLY, MESSAGE].map(String)},
|
{kinds: [DELETE], "#k": [NOTE, COMMENT, MESSAGE].map(String)},
|
||||||
{kinds: [MEMBERSHIPS], "#r": [url]},
|
{kinds: [MEMBERSHIPS], "#r": [url]},
|
||||||
],
|
],
|
||||||
relays: [url],
|
relays: [url],
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
import MenuSpace from "@app/components/MenuSpace.svelte"
|
import MenuSpace from "@app/components/MenuSpace.svelte"
|
||||||
import ThreadItem from "@app/components/ThreadItem.svelte"
|
import ThreadItem from "@app/components/ThreadItem.svelte"
|
||||||
import ThreadCreate from "@app/components/ThreadCreate.svelte"
|
import ThreadCreate from "@app/components/ThreadCreate.svelte"
|
||||||
import {REPLY, deriveEventsForUrl, decodeRelay} from "@app/state"
|
import {COMMENT, deriveEventsForUrl, decodeRelay} from "@app/state"
|
||||||
import {pushModal, pushDrawer} from "@app/modal"
|
import {pushModal, pushDrawer} from "@app/modal"
|
||||||
|
|
||||||
const url = decodeRelay($page.params.relay)
|
const url = decodeRelay($page.params.relay)
|
||||||
const events = deriveEventsForUrl(url, [NOTE])
|
const events = deriveEventsForUrl(url, [NOTE])
|
||||||
const mutedPubkeys = getPubkeyTagValues(getListTags($userMutes))
|
const mutedPubkeys = getPubkeyTagValues(getListTags($userMutes))
|
||||||
const feed = makeIntersectionFeed(makeRelayFeed(url), feedFromFilter({kinds: [NOTE, REPLY]}))
|
const feed = makeIntersectionFeed(makeRelayFeed(url), feedFromFilter({kinds: [NOTE, COMMENT]}))
|
||||||
const loader = feedLoader.getLoader(feed, {
|
const loader = feedLoader.getLoader(feed, {
|
||||||
onExhausted: () => {
|
onExhausted: () => {
|
||||||
loading = false
|
loading = false
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
GENERAL,
|
GENERAL,
|
||||||
tagRoom,
|
tagRoom,
|
||||||
MESSAGE,
|
MESSAGE,
|
||||||
REPLY,
|
COMMENT,
|
||||||
getMembershipRoomsByUrl,
|
getMembershipRoomsByUrl,
|
||||||
} from "@app/state"
|
} from "@app/state"
|
||||||
import {addRoomMembership, removeRoomMembership} from "@app/commands"
|
import {addRoomMembership, removeRoomMembership} from "@app/commands"
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
let previousPubkey
|
let previousPubkey
|
||||||
|
|
||||||
for (const {event} of sortBy(m => m.event.created_at, $channel?.messages || [])) {
|
for (const {event} of sortBy(m => m.event.created_at, $channel?.messages || [])) {
|
||||||
if (event.kind === REPLY) {
|
if (event.kind === COMMENT) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
import NoteCard from "@app/components/NoteCard.svelte"
|
import NoteCard from "@app/components/NoteCard.svelte"
|
||||||
import ThreadActions from "@app/components/ThreadActions.svelte"
|
import ThreadActions from "@app/components/ThreadActions.svelte"
|
||||||
import ThreadReply from "@app/components/ThreadReply.svelte"
|
import ThreadReply from "@app/components/ThreadReply.svelte"
|
||||||
import {REPLY, deriveEvent, decodeRelay} from "@app/state"
|
import {COMMENT, deriveEvent, decodeRelay} from "@app/state"
|
||||||
import {makeSpacePath} from "@app/routes"
|
import {makeSpacePath} from "@app/routes"
|
||||||
|
|
||||||
const {relay, id} = $page.params
|
const {relay, id} = $page.params
|
||||||
const url = decodeRelay(relay)
|
const url = decodeRelay(relay)
|
||||||
const event = deriveEvent(id)
|
const event = deriveEvent(id)
|
||||||
const filters = [{kinds: [REPLY], "#E": [id]}]
|
const filters = [{kinds: [COMMENT], "#E": [id]}]
|
||||||
const replies = deriveEvents(repository, {filters})
|
const replies = deriveEvents(repository, {filters})
|
||||||
|
|
||||||
const back = () => history.back()
|
const back = () => history.back()
|
||||||
|
|||||||
Reference in New Issue
Block a user