tangled
alpha
login
or
join now
whey.party
/
red-dwarf
82
fork
atom
an independent Bluesky client using Constellation, PDS Queries, and other services
reddwarf.app
frontend
spa
bluesky
reddwarf
microcosm
client
app
82
fork
atom
overview
issues
25
pulls
pipelines
remove old tests
whey.party
1 month ago
511e5391
cde0d3df
+15
-8
2 changed files
expand all
collapse all
unified
split
src
components
ModerationInitializer.tsx
routes
moderation.tsx
+12
-5
src/components/ModerationInitializer.tsx
···
8
8
import { useQueryIdentity } from "~/utils/useQuery";
9
9
import { useQueryPreferences } from "~/utils/useQuery";
10
10
11
11
+
export const BSKY_LABELER_DID = "did:plc:ar7c4by46qjdydhdevvrndac";
12
12
+
11
13
// Manual DID document resolution
12
14
const fetchDidDocument = async (did: string): Promise<any> => {
13
15
if (did.startsWith("did:plc:")) {
···
47
49
});
48
50
49
51
// 3. Identify Labeler DIDs from prefs
50
50
-
const labelerDids =
52
52
+
const userPrefDids =
51
53
prefs?.preferences
52
54
?.find((pref: any) => pref.$type === "app.bsky.actor.defs#labelersPref")
53
55
?.labelers?.map((l: any) => l.did) ?? [];
56
56
+
57
57
+
// 2. MERGE: Force Bsky DID + User DIDs (Set removes duplicates)
58
58
+
const activeLabelerDids = Array.from(
59
59
+
new Set([BSKY_LABELER_DID, ...userPrefDids])
60
60
+
);
54
61
55
62
// 4. Parallel fetch all Labeler DID Documents and Service Records
56
63
const labelerDidDocQueries = useQueries({
57
57
-
queries: labelerDids.map((did: string) => ({
64
64
+
queries: activeLabelerDids.map((did: string) => ({
58
65
queryKey: ["labelerDidDoc", did],
59
66
queryFn: () => fetchDidDocument(did),
60
67
staleTime: 5 * 60 * 1000, // 5 minutes
···
63
70
});
64
71
65
72
const labelerServiceQueries = useQueries({
66
66
-
queries: labelerDids.map((did: string) => ({
73
73
+
queries: activeLabelerDids.map((did: string) => ({
67
74
queryKey: ["labelerService", did],
68
75
queryFn: async () => {
69
76
if (!identity?.pds) throw new Error("No PDS URL");
···
99
106
globalPrefs[pref.label] = pref.visibility as LabelPreference;
100
107
});
101
108
102
102
-
const definitions: LabelerDefinition[] = labelerDids
109
109
+
const definitions: LabelerDefinition[] = activeLabelerDids
103
110
.map((did: string, index: number) => {
104
111
const didDocQuery = labelerDidDocQueries[index];
105
112
const serviceQuery = labelerServiceQueries[index];
···
158
165
.filter(Boolean) as LabelerDefinition[];
159
166
160
167
setLabelerConfig(definitions);
161
161
-
}, [prefs, labelerDidDocQueries, labelerServiceQueries, setLabelerConfig, identity?.pds, labelerDids]);
168
168
+
}, [prefs, labelerDidDocQueries, labelerServiceQueries, setLabelerConfig, identity?.pds, activeLabelerDids]);
162
169
163
170
return null; // Headless component
164
171
};
+3
-3
src/routes/moderation.tsx
···
50
50
return (
51
51
<div>
52
52
<Header
53
53
-
title={`Moderation`}
53
53
+
title={`Moderation (WIP)`}
54
54
backButtonCallback={() => {
55
55
if (window.history.length > 1) {
56
56
window.history.back();
···
108
108
</Switch.Root>
109
109
</div>
110
110
111
111
-
<TestModeration subject="did:plc:q7suwaz53ztc4mbiqyygbn43" />
111
111
+
{/* <TestModeration subject="did:plc:q7suwaz53ztc4mbiqyygbn43" />
112
112
<TestModeration subject="did:plc:fpruhuo22xkm5o7ttr2ktxdo" />
113
113
<TestModeration subject="did:plc:6ayddqghxhciedbaofoxkcbs" />
114
114
<TestModeration subject="did:plc:za2ezszbzyqer7eylvtgapd5" />
115
115
<TestModeration subject="did:plc:ia76kvnndjutgedggx2ibrem" />
116
116
-
<TestModeration subject="did:plc:w2wbinubagmo4hlxx2ik5rrp" />
116
116
+
<TestModeration subject="did:plc:w2wbinubagmo4hlxx2ik5rrp" /> */}
117
117
<div className="">
118
118
{Object.entries(parsedPref?.contentLabelPrefs ?? {}).map(
119
119
([label, visibility]) => (