Fix some tag utilities, re-work content rendering
This commit is contained in:
@@ -63,23 +63,23 @@ export const removeFromListByPredicate = (list: List, pred: (t: string[]) => boo
|
||||
export const removeFromList = (list: List, value: string) =>
|
||||
removeFromListByPredicate(list, nthEq(1, value))
|
||||
|
||||
export const addToListPublicly = (list: List, tag: string[]) => {
|
||||
export const addToListPublicly = (list: List, ...tags: string[][]) => {
|
||||
const template = {
|
||||
kind: list.kind,
|
||||
content: list.event?.content || "",
|
||||
tags: uniqTags(append(tag, list.publicTags)),
|
||||
tags: uniqTags([...list.publicTags, ...tags]),
|
||||
}
|
||||
|
||||
return new Encryptable(template, {})
|
||||
}
|
||||
|
||||
export const addToListPrivately = (list: List, tag: string[]) => {
|
||||
export const addToListPrivately = (list: List, ...tags: string[][]) => {
|
||||
const template = {
|
||||
kind: list.kind,
|
||||
tags: list.publicTags,
|
||||
}
|
||||
|
||||
return new Encryptable(template, {
|
||||
content: JSON.stringify(uniqTags(append(tag, list.privateTags))),
|
||||
content: JSON.stringify(uniqTags([...list.privateTags, ...tags])),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user