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,
|
||||
} from "@welshman/app"
|
||||
import {
|
||||
REPLY,
|
||||
COMMENT,
|
||||
tagRoom,
|
||||
userMembership,
|
||||
MEMBERSHIPS,
|
||||
@@ -320,7 +320,7 @@ export type ReplyParams = {
|
||||
tags?: string[][]
|
||||
}
|
||||
|
||||
export const makeReply = ({event, content, tags = []}: ReplyParams) => {
|
||||
export const makeComment = ({event, content, tags = []}: ReplyParams) => {
|
||||
const seenRoots = new Set<string>()
|
||||
|
||||
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])
|
||||
}
|
||||
|
||||
return createEvent(REPLY, {content, tags})
|
||||
return createEvent(COMMENT, {content, tags})
|
||||
}
|
||||
|
||||
export const publishReply = ({relays, ...params}: ReplyParams & {relays: string[]}) =>
|
||||
publishThunk({event: makeReply(params), relays})
|
||||
export const publishComment = ({relays, ...params}: ReplyParams & {relays: string[]}) =>
|
||||
publishThunk({event: makeComment(params), relays})
|
||||
|
||||
export const makeDelete = ({event}: {event: TrustedEvent}) =>
|
||||
createEvent(DELETE, {tags: [["k", String(event.kind)], ...tagEvent(event)]})
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
import {deriveEvents} from "@welshman/store"
|
||||
import ChannelMessage from "@app/components/ChannelMessage.svelte"
|
||||
import ChannelCompose from "@app/components/ChannelCompose.svelte"
|
||||
import {tagRoom, REPLY} from "@app/state"
|
||||
import {publishReply} from "@app/commands"
|
||||
import {tagRoom, COMMENT} from "@app/state"
|
||||
import {publishComment} from "@app/commands"
|
||||
|
||||
export let url, room, event: TrustedEvent
|
||||
|
||||
const thunks = writable({} as Record<string, Thunk>)
|
||||
|
||||
const replies = deriveEvents(repository, {
|
||||
filters: [{kinds: [REPLY], "#E": [event.id]}],
|
||||
filters: [{kinds: [COMMENT], "#E": [event.id]}],
|
||||
})
|
||||
|
||||
const onSubmit = ({content, tags}: EventContent) => {
|
||||
const thunk = publishReply({
|
||||
const thunk = publishComment({
|
||||
event,
|
||||
content,
|
||||
tags: append(tagRoom(room, url), tags),
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import Link from "@lib/components/Link.svelte"
|
||||
import Spinner from "@lib/components/Spinner.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"
|
||||
|
||||
export let value
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
// 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))
|
||||
$: 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)
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import {deriveEvents} from "@welshman/store"
|
||||
import {repository} from "@welshman/app"
|
||||
import Icon from "@lib/components/Icon.svelte"
|
||||
import {REPLY} from "@app/state"
|
||||
import {COMMENT} from "@app/state"
|
||||
|
||||
export let event
|
||||
|
||||
const replies = deriveEvents(repository, {filters: [{kinds: [REPLY], "#E": [event.id]}]})
|
||||
const replies = deriveEvents(repository, {filters: [{kinds: [COMMENT], "#E": [event.id]}]})
|
||||
</script>
|
||||
|
||||
{#if $replies.length > 0}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
||||
import ThreadMenu from "@app/components/ThreadMenu.svelte"
|
||||
import {publishDelete, publishReaction} from "@app/commands"
|
||||
import {REPLY} from "@app/state"
|
||||
import {COMMENT} from "@app/state"
|
||||
|
||||
export let url
|
||||
export let event
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
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()
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
import ThreadShare from "@app/components/ThreadShare.svelte"
|
||||
import {publishDelete} from "@app/commands"
|
||||
import {pushModal} from "@app/modal"
|
||||
import {REPLY} from "@app/state"
|
||||
import {COMMENT} from "@app/state"
|
||||
|
||||
export let url
|
||||
export let event
|
||||
export let onClick
|
||||
|
||||
const isRoot = event.kind !== REPLY
|
||||
const isRoot = event.kind !== COMMENT
|
||||
|
||||
const showInfo = () => {
|
||||
onClick()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Icon from "@lib/components/Icon.svelte"
|
||||
import Button from "@lib/components/Button.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 {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>
|
||||
|
||||
@@ -66,7 +66,7 @@ export const GENERAL = "general"
|
||||
|
||||
export const MESSAGE = 209
|
||||
|
||||
export const REPLY = 1111
|
||||
export const COMMENT = 1111
|
||||
|
||||
export const MEMBERSHIPS = 10209
|
||||
|
||||
@@ -360,7 +360,7 @@ export const readMessage = (event: TrustedEvent): Maybe<ChannelMessage> => {
|
||||
}
|
||||
|
||||
export const channelMessages = deriveEventsMapped<ChannelMessage>(repository, {
|
||||
filters: [{kinds: [MESSAGE, REPLY]}],
|
||||
filters: [{kinds: [MESSAGE, COMMENT]}],
|
||||
eventToItem: readMessage,
|
||||
itemToEvent: item => item.event,
|
||||
})
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
import Delay from "@lib/components/Delay.svelte"
|
||||
import SecondaryNav from "@lib/components/SecondaryNav.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)
|
||||
|
||||
onMount(() => {
|
||||
const sub = subscribe({
|
||||
filters: [
|
||||
{kinds: [DELETE], "#k": [NOTE, REPLY, MESSAGE].map(String)},
|
||||
{kinds: [DELETE], "#k": [NOTE, COMMENT, MESSAGE].map(String)},
|
||||
{kinds: [MEMBERSHIPS], "#r": [url]},
|
||||
],
|
||||
relays: [url],
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
import MenuSpace from "@app/components/MenuSpace.svelte"
|
||||
import ThreadItem from "@app/components/ThreadItem.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"
|
||||
|
||||
const url = decodeRelay($page.params.relay)
|
||||
const events = deriveEventsForUrl(url, [NOTE])
|
||||
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, {
|
||||
onExhausted: () => {
|
||||
loading = false
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
GENERAL,
|
||||
tagRoom,
|
||||
MESSAGE,
|
||||
REPLY,
|
||||
COMMENT,
|
||||
getMembershipRoomsByUrl,
|
||||
} from "@app/state"
|
||||
import {addRoomMembership, removeRoomMembership} from "@app/commands"
|
||||
@@ -66,7 +66,7 @@
|
||||
let previousPubkey
|
||||
|
||||
for (const {event} of sortBy(m => m.event.created_at, $channel?.messages || [])) {
|
||||
if (event.kind === REPLY) {
|
||||
if (event.kind === COMMENT) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
import NoteCard from "@app/components/NoteCard.svelte"
|
||||
import ThreadActions from "@app/components/ThreadActions.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"
|
||||
|
||||
const {relay, id} = $page.params
|
||||
const url = decodeRelay(relay)
|
||||
const event = deriveEvent(id)
|
||||
const filters = [{kinds: [REPLY], "#E": [id]}]
|
||||
const filters = [{kinds: [COMMENT], "#E": [id]}]
|
||||
const replies = deriveEvents(repository, {filters})
|
||||
|
||||
const back = () => history.back()
|
||||
|
||||
Reference in New Issue
Block a user