mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-11 11:27:03 +00:00
Add remove group, format
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import {goto} from '$app/navigation'
|
||||
import {append, uniqBy, now} from '@welshman/lib'
|
||||
import {goto} from "$app/navigation"
|
||||
import {append, uniqBy, now} from "@welshman/lib"
|
||||
import {GROUPS, asDecryptedEvent, readList, editList, makeList, createList} from "@welshman/util"
|
||||
import {pushToast} from '@app/toast'
|
||||
import {pk, signer, repository, INDEXER_RELAYS} from '@app/base'
|
||||
import {splitGroupId, loadRelay, loadGroup, getWriteRelayUrls, loadRelaySelections, publish, ensurePlaintext} from '@app/state'
|
||||
import {pushToast} from "@app/toast"
|
||||
import {pk, signer, repository, INDEXER_RELAYS} from "@app/base"
|
||||
import {
|
||||
splitGroupId,
|
||||
loadRelay,
|
||||
loadGroup,
|
||||
getWriteRelayUrls,
|
||||
loadRelaySelections,
|
||||
publish,
|
||||
ensurePlaintext,
|
||||
} from "@app/state"
|
||||
|
||||
export type ModifyTags = (tags: string[][]) => string[][]
|
||||
|
||||
@@ -37,5 +45,8 @@ export const updateList = async (kind: number, modifyTags: ModifyTags) => {
|
||||
await publish({event, relays})
|
||||
}
|
||||
|
||||
export const updateGroupMemberships = (newTags: string[][]) =>
|
||||
updateList(GROUPS, (tags: string[][]) => uniqBy(t => t.join(''), [...tags, ...newTags]))
|
||||
export const addGroupMemberships = (newTags: string[][]) =>
|
||||
updateList(GROUPS, (tags: string[][]) => uniqBy(t => t.join(""), [...tags, ...newTags]))
|
||||
|
||||
export const removeGroupMemberships = (noms: string[]) =>
|
||||
updateList(GROUPS, (tags: string[][]) => tags.filter(t => !noms.includes(t[1])))
|
||||
|
||||
Reference in New Issue
Block a user