From 9f0c7ca25a23fa0decd5338679f95176c182932c Mon Sep 17 00:00:00 2001 From: Youn Mélois Date: Tue, 10 Mar 2026 17:55:38 +0000 Subject: [PATCH] appview/strings: delete PDS record when deleting a string Orphaned `sh.tangled.string` records on users' PDSs cannot be cleaned up by the appview and they would need to be removed manually by each user. Signed-off-by: Youn Mélois --- appview/strings/strings.go | 16 ++++++++++++++++ 1 file(s) changed, 16 insertion(s)(+), 0 deletion(s)(-) diff --git a/appview/strings/strings.go b/appview/strings/strings.go --- a/appview/strings/strings.go +++ b/appview/strings/strings.go @@ -407,6 +407,22 @@ fail("You cannot delete this string", fmt.Errorf("unauthorized deletion, %s != %s", user.Active.Did, id.DID.String())) return } + client, err := s.OAuth.AuthorizedClient(r) + if err != nil { + fail("Failed to authorize client.", err) + return + } + + _, err = comatproto.RepoDeleteRecord(r.Context(), client, &comatproto.RepoDeleteRecord_Input{ + Collection: tangled.StringNSID, + Repo: user.Active.Did, + Rkey: rkey, + }) + if err != nil { + fail("Failed to delete string record from PDS.", err) + return + } + if err := db.DeleteString( s.Db, orm.FilterEq("did", user.Active.Did), -- tangled.sh