2026-07-28 16:16:26 +00:00
|
|
|
import {derived} from "svelte/store"
|
2026-08-17 16:21:30 +00:00
|
|
|
import {REPORT, sortEventsDesc} from "@welshman/util"
|
|
|
|
|
import {rooms} from "@app/core"
|
2026-09-18 08:42:42 +00:00
|
|
|
import {deriveSpaceSupportedMethods} from "@app/management"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {deriveEventsForUrl} from "@app/repository"
|
2026-07-28 16:16:26 +00:00
|
|
|
|
2026-06-08 22:33:38 +00:00
|
|
|
// Action items (admin review queue)
|
|
|
|
|
|
2026-09-18 08:42:42 +00:00
|
|
|
// A report is resolved by banning the event it names, a join request by allowing the pubkey, so
|
|
|
|
|
// the queue holds whichever of the two the user can actually act on.
|
2026-06-08 22:33:38 +00:00
|
|
|
export const deriveSpaceActionItems = (url: string) =>
|
|
|
|
|
derived(
|
2026-09-18 08:42:42 +00:00
|
|
|
[
|
|
|
|
|
deriveEventsForUrl(url, [{kinds: [REPORT]}]),
|
|
|
|
|
rooms.get().pendingJoins(url).$,
|
|
|
|
|
deriveSpaceSupportedMethods(url),
|
|
|
|
|
],
|
|
|
|
|
([$reports, $pendingJoins, $methods]) =>
|
|
|
|
|
sortEventsDesc([
|
|
|
|
|
...($methods.includes("banevent") ? $reports : []),
|
|
|
|
|
...($methods.includes("allowpubkey") ? $pendingJoins : []),
|
|
|
|
|
]),
|
2026-06-08 22:33:38 +00:00
|
|
|
)
|