feat: add option to add client tag
This commit is contained in:
parent
234319ef50
commit
31f70c2ab1
8 changed files with 117 additions and 12 deletions
|
|
@ -39,10 +39,13 @@ export function createRepostDraftEvent(event: Event): TDraftEvent {
|
|||
|
||||
export async function createShortTextNoteDraftEvent(
|
||||
content: string,
|
||||
parentEvent?: Event
|
||||
options: {
|
||||
parentEvent?: Event
|
||||
addClientTag?: boolean
|
||||
} = {}
|
||||
): Promise<TDraftEvent> {
|
||||
const { pubkeys, otherRelatedEventIds, quoteEventIds, rootEventId, parentEventId } =
|
||||
await extractMentions(content, parentEvent)
|
||||
await extractMentions(content, options.parentEvent)
|
||||
const hashtags = extractHashtags(content)
|
||||
|
||||
const tags = pubkeys
|
||||
|
|
@ -50,7 +53,6 @@ export async function createShortTextNoteDraftEvent(
|
|||
.concat(otherRelatedEventIds.map((eventId) => ['e', eventId]))
|
||||
.concat(quoteEventIds.map((eventId) => ['q', eventId]))
|
||||
.concat(hashtags.map((hashtag) => ['t', hashtag]))
|
||||
.concat([['client', 'jumble']])
|
||||
|
||||
if (rootEventId) {
|
||||
tags.push(['e', rootEventId, '', 'root'])
|
||||
|
|
@ -60,6 +62,10 @@ export async function createShortTextNoteDraftEvent(
|
|||
tags.push(['e', parentEventId, '', 'reply'])
|
||||
}
|
||||
|
||||
if (options.addClientTag) {
|
||||
tags.push(['client', 'jumble'])
|
||||
}
|
||||
|
||||
return {
|
||||
kind: kinds.ShortTextNote,
|
||||
content,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue