Add protected tag
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
import ChannelMessageEmojiButton from "@app/components/ChannelMessageEmojiButton.svelte"
|
import ChannelMessageEmojiButton from "@app/components/ChannelMessageEmojiButton.svelte"
|
||||||
import ChannelMessageMenuButton from "@app/components/ChannelMessageMenuButton.svelte"
|
import ChannelMessageMenuButton from "@app/components/ChannelMessageMenuButton.svelte"
|
||||||
import ChannelMessageMenuMobile from "@app/components/ChannelMessageMenuMobile.svelte"
|
import ChannelMessageMenuMobile from "@app/components/ChannelMessageMenuMobile.svelte"
|
||||||
import {colors, tagRoom, pubkeyLink} from "@app/state"
|
import {colors, tagRoom, pubkeyLink, PROTECTED} from "@app/state"
|
||||||
import {publishDelete, publishReaction} from "@app/commands"
|
import {publishDelete, publishReaction} from "@app/commands"
|
||||||
import {pushModal} from "@app/modal"
|
import {pushModal} from "@app/modal"
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
event,
|
event,
|
||||||
content,
|
content,
|
||||||
relays: [url],
|
relays: [url],
|
||||||
tags: [tagRoom(room, url)],
|
tags: [tagRoom(room, url), PROTECTED],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import type {NativeEmoji} from "emoji-picker-element/shared"
|
import type {NativeEmoji} from "emoji-picker-element/shared"
|
||||||
import EmojiButton from "@lib/components/EmojiButton.svelte"
|
import EmojiButton from "@lib/components/EmojiButton.svelte"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import {tagRoom} from "@app/state"
|
import {tagRoom, PROTECTED} from "@app/state"
|
||||||
import {publishReaction} from "@app/commands"
|
import {publishReaction} from "@app/commands"
|
||||||
|
|
||||||
export let url, room, event
|
export let url, room, event
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
event,
|
event,
|
||||||
relays: [url],
|
relays: [url],
|
||||||
content: emoji.unicode,
|
content: emoji.unicode,
|
||||||
tags: [tagRoom(room, url)],
|
tags: [tagRoom(room, url), PROTECTED],
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import ConfirmDelete from "@app/components/ConfirmDelete.svelte"
|
import ConfirmDelete from "@app/components/ConfirmDelete.svelte"
|
||||||
import {publishReaction} from "@app/commands"
|
import {publishReaction} from "@app/commands"
|
||||||
import {pushModal} from "@app/modal"
|
import {pushModal} from "@app/modal"
|
||||||
import {tagRoom} from "@app/state"
|
import {tagRoom, PROTECTED} from "@app/state"
|
||||||
|
|
||||||
export let url
|
export let url
|
||||||
export let room
|
export let room
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
event,
|
event,
|
||||||
relays: [url],
|
relays: [url],
|
||||||
content: emoji.unicode,
|
content: emoji.unicode,
|
||||||
tags: [tagRoom(room, url)],
|
tags: [tagRoom(room, url), PROTECTED],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import DateTimeInput from "@lib/components/DateTimeInput.svelte"
|
import DateTimeInput from "@lib/components/DateTimeInput.svelte"
|
||||||
|
import {PROTECTED} from "@app/state"
|
||||||
import {getPubkeyHints} from "@app/commands"
|
import {getPubkeyHints} from "@app/commands"
|
||||||
import {getEditorOptions, getEditorTags} from "@lib/editor"
|
import {getEditorOptions, getEditorTags} from "@lib/editor"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
@@ -46,6 +47,7 @@
|
|||||||
["start", dateToSeconds(start).toString()],
|
["start", dateToSeconds(start).toString()],
|
||||||
["end", dateToSeconds(end).toString()],
|
["end", dateToSeconds(end).toString()],
|
||||||
...getEditorTags($editor),
|
...getEditorTags($editor),
|
||||||
|
PROTECTED,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import NoteCard from "@app/components/NoteCard.svelte"
|
import NoteCard from "@app/components/NoteCard.svelte"
|
||||||
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
||||||
import {publishDelete, publishReaction} from "@app/commands"
|
import {publishDelete, publishReaction} from "@app/commands"
|
||||||
|
import {PROTECTED} from "@app/state"
|
||||||
|
|
||||||
export let url
|
export let url
|
||||||
export let event
|
export let event
|
||||||
@@ -18,12 +19,12 @@
|
|||||||
if (reaction) {
|
if (reaction) {
|
||||||
publishDelete({relays: [url], event: reaction})
|
publishDelete({relays: [url], event: reaction})
|
||||||
} else {
|
} else {
|
||||||
publishReaction({event, content, relays: [url]})
|
publishReaction({event, content, tags: [PROTECTED], relays: [url]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onEmoji = (emoji: NativeEmoji) =>
|
const onEmoji = (emoji: NativeEmoji) =>
|
||||||
publishReaction({event, relays: [url], content: emoji.unicode})
|
publishReaction({event, content: emoji.unicode, tags: [PROTECTED], relays: [url]})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NoteCard {event} class="card2 bg-alt">
|
<NoteCard {event} class="card2 bg-alt">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
import {publishDelete, publishReaction} from "@app/commands"
|
import {publishDelete, publishReaction} from "@app/commands"
|
||||||
import {deriveNotification} from "@app/notifications"
|
import {deriveNotification} from "@app/notifications"
|
||||||
import {makeSpacePath} from "@app/routes"
|
import {makeSpacePath} from "@app/routes"
|
||||||
import {COMMENT} from "@app/state"
|
import {COMMENT, PROTECTED} from "@app/state"
|
||||||
|
|
||||||
export let url
|
export let url
|
||||||
export let event
|
export let event
|
||||||
@@ -39,12 +39,12 @@
|
|||||||
if (reaction) {
|
if (reaction) {
|
||||||
publishDelete({relays: [url], event: reaction})
|
publishDelete({relays: [url], event: reaction})
|
||||||
} else {
|
} else {
|
||||||
publishReaction({event, content, relays: [url]})
|
publishReaction({event, content, tags: [PROTECTED], relays: [url]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onEmoji = (emoji: NativeEmoji) =>
|
const onEmoji = (emoji: NativeEmoji) =>
|
||||||
publishReaction({event, relays: [url], content: emoji.unicode})
|
publishReaction({event, content: emoji.unicode, tags: [PROTECTED], relays: [url]})
|
||||||
|
|
||||||
let popover: Instance
|
let popover: Instance
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
import {THREAD, GENERAL, tagRoom} from "@app/state"
|
import {THREAD, GENERAL, tagRoom, PROTECTED} from "@app/state"
|
||||||
import {getPubkeyHints} from "@app/commands"
|
import {getPubkeyHints} from "@app/commands"
|
||||||
import {getEditorOptions, getEditorTags} from "@lib/editor"
|
import {getEditorOptions, getEditorTags} from "@lib/editor"
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const tags = [["title", title], tagRoom(GENERAL, url), ...getEditorTags($editor)]
|
const tags = [["title", title], tagRoom(GENERAL, url), ...getEditorTags($editor), PROTECTED]
|
||||||
|
|
||||||
publishThunk({
|
publishThunk({
|
||||||
relays: [url],
|
relays: [url],
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import {onMount} from "svelte"
|
import {onMount} from "svelte"
|
||||||
import type {Readable} from "svelte/store"
|
import type {Readable} from "svelte/store"
|
||||||
import {createEditor, type Editor, EditorContent} from "svelte-tiptap"
|
import {createEditor, type Editor, EditorContent} from "svelte-tiptap"
|
||||||
import {append} from "@welshman/lib"
|
|
||||||
import {isMobile} from "@lib/html"
|
import {isMobile} from "@lib/html"
|
||||||
import {fly, slideAndFade} from "@lib/transition"
|
import {fly, slideAndFade} from "@lib/transition"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
@@ -10,7 +9,7 @@
|
|||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import {getEditorOptions, getEditorTags} from "@lib/editor"
|
import {getEditorOptions, getEditorTags} from "@lib/editor"
|
||||||
import {getPubkeyHints, publishComment} from "@app/commands"
|
import {getPubkeyHints, publishComment} from "@app/commands"
|
||||||
import {tagRoom, GENERAL} from "@app/state"
|
import {tagRoom, GENERAL, PROTECTED} from "@app/state"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
|
|
||||||
export let url
|
export let url
|
||||||
@@ -22,7 +21,7 @@
|
|||||||
if ($loading) return
|
if ($loading) return
|
||||||
|
|
||||||
const content = $editor.getText({blockSeparator: "\n"})
|
const content = $editor.getText({blockSeparator: "\n"})
|
||||||
const tags = append(tagRoom(GENERAL, url), getEditorTags($editor))
|
const tags = [...getEditorTags($editor), tagRoom(GENERAL, url), [PROTECTED]]
|
||||||
|
|
||||||
if (!content.trim()) {
|
if (!content.trim()) {
|
||||||
return pushToast({
|
return pushToast({
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ export const ROOM = "h"
|
|||||||
|
|
||||||
export const GENERAL = "_"
|
export const GENERAL = "_"
|
||||||
|
|
||||||
|
export const PROTECTED = ["-"]
|
||||||
|
|
||||||
export const MESSAGE = 9
|
export const MESSAGE = 9
|
||||||
|
|
||||||
export const THREAD = 11
|
export const THREAD = 11
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import type {Readable} from "svelte/store"
|
import type {Readable} from "svelte/store"
|
||||||
import type {Editor} from "svelte-tiptap"
|
import type {Editor} from "svelte-tiptap"
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
import {sleep, append, now, ctx} from "@welshman/lib"
|
import {sleep, now, ctx} from "@welshman/lib"
|
||||||
import type {TrustedEvent, EventContent} from "@welshman/util"
|
import type {TrustedEvent, EventContent} from "@welshman/util"
|
||||||
import {createEvent, DELETE} from "@welshman/util"
|
import {createEvent, DELETE} from "@welshman/util"
|
||||||
import {formatTimestampAsDate, publishThunk} from "@welshman/app"
|
import {formatTimestampAsDate, publishThunk} from "@welshman/app"
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
} from "@app/state"
|
} from "@app/state"
|
||||||
import {setChecked} from "@app/notifications"
|
import {setChecked} from "@app/notifications"
|
||||||
import {addRoomMembership, removeRoomMembership, subscribePersistent} from "@app/commands"
|
import {addRoomMembership, removeRoomMembership, subscribePersistent} from "@app/commands"
|
||||||
|
import {PROTECTED} from "@app/state"
|
||||||
import {popKey} from "@app/implicit"
|
import {popKey} from "@app/implicit"
|
||||||
|
|
||||||
const {room = GENERAL} = $page.params
|
const {room = GENERAL} = $page.params
|
||||||
@@ -62,7 +63,7 @@
|
|||||||
const onSubmit = ({content, tags}: EventContent) =>
|
const onSubmit = ({content, tags}: EventContent) =>
|
||||||
publishThunk({
|
publishThunk({
|
||||||
relays: [url],
|
relays: [url],
|
||||||
event: createEvent(MESSAGE, {content, tags: append(tagRoom(room, url), tags)}),
|
event: createEvent(MESSAGE, {content, tags: [...tags, tagRoom(room, url), PROTECTED]}),
|
||||||
delay: $userSettingValues.send_delay,
|
delay: $userSettingValues.send_delay,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user