From f2f804f3cbeaf0a17201005e08650d323dd02ea8 Mon Sep 17 00:00:00 2001 From: dawn Date: Sat, 29 Aug 2026 19:08:38 +0900 Subject: [PATCH] lexicons,api,spindle: rename spindle.mod to spindle.moderation Signed-off-by: dawn --- api/tangled/modban.go | 30 ------------ api/tangled/moderationban.go | 30 ++++++++++++ api/tangled/{moddefs.go => moderationdefs.go} | 6 +-- api/tangled/moderationgetBan.go | 36 +++++++++++++++ api/tangled/moderationlistBans.go | 31 +++++++++++++ api/tangled/moderationunban.go | 30 ++++++++++++ api/tangled/modgetBan.go | 36 --------------- api/tangled/modlistBans.go | 31 ------------- api/tangled/modunban.go | 30 ------------ .../temp/spindle/{mod => moderation}/ban.json | 2 +- .../spindle/{mod => moderation}/defs.json | 2 +- .../spindle/{mod => moderation}/getBan.json | 4 +- .../spindle/{mod => moderation}/listBans.json | 4 +- .../spindle/{mod => moderation}/unban.json | 2 +- spindle/xrpc/ban.go | 14 +++--- spindle/xrpc/ban_test.go | 46 +++++++++---------- spindle/xrpc/xrpc.go | 8 ++-- 17 files changed, 171 insertions(+), 171 deletions(-) delete mode 100644 api/tangled/modban.go create mode 100644 api/tangled/moderationban.go rename api/tangled/{moddefs.go => moderationdefs.go} (65%) create mode 100644 api/tangled/moderationgetBan.go create mode 100644 api/tangled/moderationlistBans.go create mode 100644 api/tangled/moderationunban.go delete mode 100644 api/tangled/modgetBan.go delete mode 100644 api/tangled/modlistBans.go delete mode 100644 api/tangled/modunban.go rename lexicons/temp/spindle/{mod => moderation}/ban.json (92%) rename lexicons/temp/spindle/{mod => moderation}/defs.json (91%) rename lexicons/temp/spindle/{mod => moderation}/getBan.json (87%) rename lexicons/temp/spindle/{mod => moderation}/listBans.json (82%) rename lexicons/temp/spindle/{mod => moderation}/unban.json (92%) diff --git a/api/tangled/modban.go b/api/tangled/modban.go deleted file mode 100644 index ee6e1e8d7..000000000 --- a/api/tangled/modban.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package tangled - -// schema: org.tangled.temp.spindle.mod.ban - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModBanNSID = "org.tangled.temp.spindle.mod.ban" -) - -// TempSpindleModBan_Input is the input argument to a org.tangled.temp.spindle.mod.ban call. -type TempSpindleModBan_Input struct { - // did: DID of the repository or account owner to ban - Did string `json:"did" cborgen:"did"` -} - -// TempSpindleModBan calls the XRPC method "org.tangled.temp.spindle.mod.ban". -func TempSpindleModBan(ctx context.Context, c util.LexClient, input *TempSpindleModBan_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.mod.ban", nil, input, nil); err != nil { - return err - } - - return nil -} diff --git a/api/tangled/moderationban.go b/api/tangled/moderationban.go new file mode 100644 index 000000000..f440c83c6 --- /dev/null +++ b/api/tangled/moderationban.go @@ -0,0 +1,30 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: org.tangled.temp.spindle.moderation.ban + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + TempSpindleModerationBanNSID = "org.tangled.temp.spindle.moderation.ban" +) + +// TempSpindleModerationBan_Input is the input argument to a org.tangled.temp.spindle.moderation.ban call. +type TempSpindleModerationBan_Input struct { + // did: DID of the repository or account owner to ban + Did string `json:"did" cborgen:"did"` +} + +// TempSpindleModerationBan calls the XRPC method "org.tangled.temp.spindle.moderation.ban". +func TempSpindleModerationBan(ctx context.Context, c util.LexClient, input *TempSpindleModerationBan_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.moderation.ban", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/moddefs.go b/api/tangled/moderationdefs.go similarity index 65% rename from api/tangled/moddefs.go rename to api/tangled/moderationdefs.go index 18edb5506..78c3ed93a 100644 --- a/api/tangled/moddefs.go +++ b/api/tangled/moderationdefs.go @@ -2,14 +2,14 @@ package tangled -// schema: org.tangled.temp.spindle.mod.defs +// schema: org.tangled.temp.spindle.moderation.defs const () -// TempSpindleModDefs_Ban is a "ban" in the org.tangled.temp.spindle.mod.defs schema. +// TempSpindleModerationDefs_Ban is a "ban" in the org.tangled.temp.spindle.moderation.defs schema. // // an active ban for a repository or account owner -type TempSpindleModDefs_Ban struct { +type TempSpindleModerationDefs_Ban struct { // createdAt: time at which the ban was created CreatedAt string `json:"createdAt" cborgen:"createdAt"` // did: DID of the banned subject, either a repository or its owner diff --git a/api/tangled/moderationgetBan.go b/api/tangled/moderationgetBan.go new file mode 100644 index 000000000..53625d995 --- /dev/null +++ b/api/tangled/moderationgetBan.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: org.tangled.temp.spindle.moderation.getBan + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + TempSpindleModerationGetBanNSID = "org.tangled.temp.spindle.moderation.getBan" +) + +// TempSpindleModerationGetBan_Output is the output of a org.tangled.temp.spindle.moderation.getBan call. +type TempSpindleModerationGetBan_Output struct { + // ban: active ban matching the requested DID + Ban *TempSpindleModerationDefs_Ban `json:"ban" cborgen:"ban"` +} + +// TempSpindleModerationGetBan calls the XRPC method "org.tangled.temp.spindle.moderation.getBan". +// +// did: DID of the repository or account owner to look up +func TempSpindleModerationGetBan(ctx context.Context, c util.LexClient, did string) (*TempSpindleModerationGetBan_Output, error) { + var out TempSpindleModerationGetBan_Output + + params := map[string]interface{}{} + params["did"] = did + if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.moderation.getBan", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/moderationlistBans.go b/api/tangled/moderationlistBans.go new file mode 100644 index 000000000..ccfb883ac --- /dev/null +++ b/api/tangled/moderationlistBans.go @@ -0,0 +1,31 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: org.tangled.temp.spindle.moderation.listBans + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + TempSpindleModerationListBansNSID = "org.tangled.temp.spindle.moderation.listBans" +) + +// TempSpindleModerationListBans_Output is the output of a org.tangled.temp.spindle.moderation.listBans call. +type TempSpindleModerationListBans_Output struct { + // bans: active bans ordered by subject DID + Bans []*TempSpindleModerationDefs_Ban `json:"bans" cborgen:"bans"` +} + +// TempSpindleModerationListBans calls the XRPC method "org.tangled.temp.spindle.moderation.listBans". +func TempSpindleModerationListBans(ctx context.Context, c util.LexClient) (*TempSpindleModerationListBans_Output, error) { + var out TempSpindleModerationListBans_Output + if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.moderation.listBans", nil, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/moderationunban.go b/api/tangled/moderationunban.go new file mode 100644 index 000000000..398baa551 --- /dev/null +++ b/api/tangled/moderationunban.go @@ -0,0 +1,30 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: org.tangled.temp.spindle.moderation.unban + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + TempSpindleModerationUnbanNSID = "org.tangled.temp.spindle.moderation.unban" +) + +// TempSpindleModerationUnban_Input is the input argument to a org.tangled.temp.spindle.moderation.unban call. +type TempSpindleModerationUnban_Input struct { + // did: DID of the repository or account owner to unban + Did string `json:"did" cborgen:"did"` +} + +// TempSpindleModerationUnban calls the XRPC method "org.tangled.temp.spindle.moderation.unban". +func TempSpindleModerationUnban(ctx context.Context, c util.LexClient, input *TempSpindleModerationUnban_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.moderation.unban", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/tangled/modgetBan.go b/api/tangled/modgetBan.go deleted file mode 100644 index fd427dffd..000000000 --- a/api/tangled/modgetBan.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package tangled - -// schema: org.tangled.temp.spindle.mod.getBan - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModGetBanNSID = "org.tangled.temp.spindle.mod.getBan" -) - -// TempSpindleModGetBan_Output is the output of a org.tangled.temp.spindle.mod.getBan call. -type TempSpindleModGetBan_Output struct { - // ban: active ban matching the requested DID - Ban *TempSpindleModDefs_Ban `json:"ban" cborgen:"ban"` -} - -// TempSpindleModGetBan calls the XRPC method "org.tangled.temp.spindle.mod.getBan". -// -// did: DID of the repository or account owner to look up -func TempSpindleModGetBan(ctx context.Context, c util.LexClient, did string) (*TempSpindleModGetBan_Output, error) { - var out TempSpindleModGetBan_Output - - params := map[string]interface{}{} - params["did"] = did - if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.mod.getBan", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/tangled/modlistBans.go b/api/tangled/modlistBans.go deleted file mode 100644 index cc7f2ae75..000000000 --- a/api/tangled/modlistBans.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package tangled - -// schema: org.tangled.temp.spindle.mod.listBans - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModListBansNSID = "org.tangled.temp.spindle.mod.listBans" -) - -// TempSpindleModListBans_Output is the output of a org.tangled.temp.spindle.mod.listBans call. -type TempSpindleModListBans_Output struct { - // bans: active bans ordered by subject DID - Bans []*TempSpindleModDefs_Ban `json:"bans" cborgen:"bans"` -} - -// TempSpindleModListBans calls the XRPC method "org.tangled.temp.spindle.mod.listBans". -func TempSpindleModListBans(ctx context.Context, c util.LexClient) (*TempSpindleModListBans_Output, error) { - var out TempSpindleModListBans_Output - if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.mod.listBans", nil, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/tangled/modunban.go b/api/tangled/modunban.go deleted file mode 100644 index 6e970062b..000000000 --- a/api/tangled/modunban.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package tangled - -// schema: org.tangled.temp.spindle.mod.unban - -import ( - "context" - - "github.com/bluesky-social/indigo/lex/util" -) - -const ( - TempSpindleModUnbanNSID = "org.tangled.temp.spindle.mod.unban" -) - -// TempSpindleModUnban_Input is the input argument to a org.tangled.temp.spindle.mod.unban call. -type TempSpindleModUnban_Input struct { - // did: DID of the repository or account owner to unban - Did string `json:"did" cborgen:"did"` -} - -// TempSpindleModUnban calls the XRPC method "org.tangled.temp.spindle.mod.unban". -func TempSpindleModUnban(ctx context.Context, c util.LexClient, input *TempSpindleModUnban_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.mod.unban", nil, input, nil); err != nil { - return err - } - - return nil -} diff --git a/lexicons/temp/spindle/mod/ban.json b/lexicons/temp/spindle/moderation/ban.json similarity index 92% rename from lexicons/temp/spindle/mod/ban.json rename to lexicons/temp/spindle/moderation/ban.json index 6bb51a50e..326d67bd4 100644 --- a/lexicons/temp/spindle/mod/ban.json +++ b/lexicons/temp/spindle/moderation/ban.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "org.tangled.temp.spindle.mod.ban", + "id": "org.tangled.temp.spindle.moderation.ban", "defs": { "main": { "type": "procedure", diff --git a/lexicons/temp/spindle/mod/defs.json b/lexicons/temp/spindle/moderation/defs.json similarity index 91% rename from lexicons/temp/spindle/mod/defs.json rename to lexicons/temp/spindle/moderation/defs.json index b50350b2e..66952395f 100644 --- a/lexicons/temp/spindle/mod/defs.json +++ b/lexicons/temp/spindle/moderation/defs.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "org.tangled.temp.spindle.mod.defs", + "id": "org.tangled.temp.spindle.moderation.defs", "defs": { "ban": { "description": "an active ban for a repository or account owner", diff --git a/lexicons/temp/spindle/mod/getBan.json b/lexicons/temp/spindle/moderation/getBan.json similarity index 87% rename from lexicons/temp/spindle/mod/getBan.json rename to lexicons/temp/spindle/moderation/getBan.json index 485d7f65b..06e3321d9 100644 --- a/lexicons/temp/spindle/mod/getBan.json +++ b/lexicons/temp/spindle/moderation/getBan.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "org.tangled.temp.spindle.mod.getBan", + "id": "org.tangled.temp.spindle.moderation.getBan", "defs": { "main": { "type": "query", @@ -29,7 +29,7 @@ "ban": { "description": "active ban matching the requested DID", "type": "ref", - "ref": "org.tangled.temp.spindle.mod.defs#ban" + "ref": "org.tangled.temp.spindle.moderation.defs#ban" } } } diff --git a/lexicons/temp/spindle/mod/listBans.json b/lexicons/temp/spindle/moderation/listBans.json similarity index 82% rename from lexicons/temp/spindle/mod/listBans.json rename to lexicons/temp/spindle/moderation/listBans.json index 986bed08e..8963932ab 100644 --- a/lexicons/temp/spindle/mod/listBans.json +++ b/lexicons/temp/spindle/moderation/listBans.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "org.tangled.temp.spindle.mod.listBans", + "id": "org.tangled.temp.spindle.moderation.listBans", "defs": { "main": { "type": "query", @@ -18,7 +18,7 @@ "type": "array", "items": { "type": "ref", - "ref": "org.tangled.temp.spindle.mod.defs#ban" + "ref": "org.tangled.temp.spindle.moderation.defs#ban" } } } diff --git a/lexicons/temp/spindle/mod/unban.json b/lexicons/temp/spindle/moderation/unban.json similarity index 92% rename from lexicons/temp/spindle/mod/unban.json rename to lexicons/temp/spindle/moderation/unban.json index 4b8ac8b59..39d683e88 100644 --- a/lexicons/temp/spindle/mod/unban.json +++ b/lexicons/temp/spindle/moderation/unban.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "org.tangled.temp.spindle.mod.unban", + "id": "org.tangled.temp.spindle.moderation.unban", "defs": { "main": { "type": "procedure", diff --git a/spindle/xrpc/ban.go b/spindle/xrpc/ban.go index 803d01520..8a107634a 100644 --- a/spindle/xrpc/ban.go +++ b/spindle/xrpc/ban.go @@ -24,7 +24,7 @@ func (x *Xrpc) Ban(w http.ResponseWriter, r *http.Request) { return } - var data tangled.TempSpindleModBan_Input + var data tangled.TempSpindleModerationBan_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -78,7 +78,7 @@ func (x *Xrpc) Unban(w http.ResponseWriter, r *http.Request) { return } - var data tangled.TempSpindleModUnban_Input + var data tangled.TempSpindleModerationUnban_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -143,8 +143,8 @@ func (x *Xrpc) GetBan(w http.ResponseWriter, r *http.Request) { return } - out := tangled.TempSpindleModGetBan_Output{ - Ban: &tangled.TempSpindleModDefs_Ban{ + out := tangled.TempSpindleModerationGetBan_Output{ + Ban: &tangled.TempSpindleModerationDefs_Ban{ Did: ban.SubjectDid.String(), CreatedAt: ban.CreatedAt, }, @@ -174,11 +174,11 @@ func (x *Xrpc) ListBans(w http.ResponseWriter, r *http.Request) { return } - out := tangled.TempSpindleModListBans_Output{ - Bans: make([]*tangled.TempSpindleModDefs_Ban, 0, len(bans)), + out := tangled.TempSpindleModerationListBans_Output{ + Bans: make([]*tangled.TempSpindleModerationDefs_Ban, 0, len(bans)), } for _, b := range bans { - out.Bans = append(out.Bans, &tangled.TempSpindleModDefs_Ban{ + out.Bans = append(out.Bans, &tangled.TempSpindleModerationDefs_Ban{ Did: b.SubjectDid.String(), CreatedAt: b.CreatedAt, }) diff --git a/spindle/xrpc/ban_test.go b/spindle/xrpc/ban_test.go index 98ecc2b99..0aeb24803 100644 --- a/spindle/xrpc/ban_test.go +++ b/spindle/xrpc/ban_test.go @@ -62,9 +62,9 @@ func setupBanTestXrpc(t *testing.T) (*Xrpc, *fakeRepoWiper, syntax.DID, syntax.D return x, wiper, ownerDid, nonOwnerDid } -func sendBan(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModBan_Input) (*httptest.ResponseRecorder, int) { +func sendBan(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModerationBan_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModBanNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModerationBanNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -74,9 +74,9 @@ func sendBan(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModBan_Input) ( return w, w.Code } -func sendUnban(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModUnban_Input) (*httptest.ResponseRecorder, int) { +func sendUnban(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModerationUnban_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModUnbanNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModerationUnbanNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -87,7 +87,7 @@ func sendUnban(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModUnban_Inpu } func sendListBans(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { - req := httptest.NewRequest(http.MethodGet, "/"+tangled.TempSpindleModListBansNSID, nil) + req := httptest.NewRequest(http.MethodGet, "/"+tangled.TempSpindleModerationListBansNSID, nil) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -98,7 +98,7 @@ func sendListBans(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { } func sendGetBan(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRecorder, int) { - path := "/" + tangled.TempSpindleModGetBanNSID + path := "/" + tangled.TempSpindleModerationGetBanNSID if query != "" { path += "?" + query } @@ -115,7 +115,7 @@ func sendGetBan(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseReco func TestBan_OwnerAuth(t *testing.T) { x, _, ownerDid, nonOwnerDid := setupBanTestXrpc(t) - addInput := tangled.TempSpindleModBan_Input{ + addInput := tangled.TempSpindleModerationBan_Input{ Did: "did:plc:targetrepo", } @@ -149,7 +149,7 @@ func TestBan_OwnerAuth(t *testing.T) { t.Fatalf("expected 200 for owner ban list, got %d", code) } - removeInput := tangled.TempSpindleModUnban_Input{ + removeInput := tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:targetrepo", } @@ -174,17 +174,17 @@ func TestBan_ValidationErrors(t *testing.T) { tests := []struct { name string - input tangled.TempSpindleModBan_Input + input tangled.TempSpindleModerationBan_Input }{ { name: "invalid did", - input: tangled.TempSpindleModBan_Input{ + input: tangled.TempSpindleModerationBan_Input{ Did: "notadid", }, }, { name: "empty did", - input: tangled.TempSpindleModBan_Input{ + input: tangled.TempSpindleModerationBan_Input{ Did: "", }, }, @@ -208,17 +208,17 @@ func TestBan_ValidationErrors(t *testing.T) { removeTests := []struct { name string - input tangled.TempSpindleModUnban_Input + input tangled.TempSpindleModerationUnban_Input }{ { name: "invalid did remove", - input: tangled.TempSpindleModUnban_Input{ + input: tangled.TempSpindleModerationUnban_Input{ Did: "notadid", }, }, { name: "ban not found", - input: tangled.TempSpindleModUnban_Input{ + input: tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:nonexistent", }, }, @@ -234,7 +234,7 @@ func TestBan_ValidationErrors(t *testing.T) { } wiper.err = errors.New("wipe network error") - _, code := sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{ + _, code := sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{ Did: "did:plc:errorrepo", }) if code != http.StatusInternalServerError { @@ -245,7 +245,7 @@ func TestBan_ValidationErrors(t *testing.T) { func TestBan_RoundTrip(t *testing.T) { x, wiper, ownerDid, _ := setupBanTestXrpc(t) - w, code := sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{ + w, code := sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{ Did: "did:plc:repo123", }) if code != http.StatusOK { @@ -261,7 +261,7 @@ func TestBan_RoundTrip(t *testing.T) { t.Fatalf("expected wipe reason 'banned', got %v", wiper.repoReasons) } - w, code = sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{ + w, code = sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{ Did: "did:plc:badactor", }) if code != http.StatusOK { @@ -278,7 +278,7 @@ func TestBan_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for ban list, got %d", code) } - var listOut tangled.TempSpindleModListBans_Output + var listOut tangled.TempSpindleModerationListBans_Output if err := json.Unmarshal(w.Body.Bytes(), &listOut); err != nil { t.Fatalf("failed to decode ban list output: %v", err) } @@ -300,14 +300,14 @@ func TestBan_RoundTrip(t *testing.T) { t.Fatalf("expected both repo and owner bans in list, got %+v", listOut.Bans) } - w, code = sendUnban(x, ownerDid, tangled.TempSpindleModUnban_Input{ + w, code = sendUnban(x, ownerDid, tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:repo123", }) if code != http.StatusOK { t.Fatalf("expected 200 for repo ban remove, got %d", code) } - w, code = sendUnban(x, ownerDid, tangled.TempSpindleModUnban_Input{ + w, code = sendUnban(x, ownerDid, tangled.TempSpindleModerationUnban_Input{ Did: "did:plc:repo123", }) if code != http.StatusBadRequest { @@ -318,7 +318,7 @@ func TestBan_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for ban list after remove, got %d", code) } - var afterRemoveOut tangled.TempSpindleModListBans_Output + var afterRemoveOut tangled.TempSpindleModerationListBans_Output if err := json.Unmarshal(w.Body.Bytes(), &afterRemoveOut); err != nil { t.Fatalf("failed to decode ban list output: %v", err) } @@ -335,7 +335,7 @@ func TestGetBan(t *testing.T) { t.Fatalf("expected 404 before the ban, got %d", code) } - if _, code := sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{Did: banned.String()}); code != http.StatusOK { + if _, code := sendBan(x, ownerDid, tangled.TempSpindleModerationBan_Input{Did: banned.String()}); code != http.StatusOK { t.Fatalf("ban add: expected 200, got %d", code) } @@ -343,7 +343,7 @@ func TestGetBan(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 after the ban, got %d", code) } - var out tangled.TempSpindleModGetBan_Output + var out tangled.TempSpindleModerationGetBan_Output if err := json.Unmarshal(w.Body.Bytes(), &out); err != nil { t.Fatalf("decode: %v", err) } diff --git a/spindle/xrpc/xrpc.go b/spindle/xrpc/xrpc.go index 9db427b46..13bc14a7e 100644 --- a/spindle/xrpc/xrpc.go +++ b/spindle/xrpc/xrpc.go @@ -88,10 +88,10 @@ func (x *Xrpc) Router() http.Handler { r.Get("/"+tangled.TempSpindleQuotaGetNSID, x.GetLimit) r.Get("/"+tangled.TempSpindleQuotaListNSID, x.ListLimits) r.Get("/"+tangled.TempSpindleQuotaUsageNSID, x.GetUsage) - r.Post("/"+tangled.TempSpindleModBanNSID, x.Ban) - r.Post("/"+tangled.TempSpindleModUnbanNSID, x.Unban) - r.Get("/"+tangled.TempSpindleModGetBanNSID, x.GetBan) - r.Get("/"+tangled.TempSpindleModListBansNSID, x.ListBans) + r.Post("/"+tangled.TempSpindleModerationBanNSID, x.Ban) + r.Post("/"+tangled.TempSpindleModerationUnbanNSID, x.Unban) + r.Get("/"+tangled.TempSpindleModerationGetBanNSID, x.GetBan) + r.Get("/"+tangled.TempSpindleModerationListBansNSID, x.ListBans) }) // service query endpoints (no auth required) -- 2.51.2