Diffdown is a real-time collaborative Markdown editor/previewer built on the AT Protocol diffdown.com

fix: filter comments by document, fix JSON field names

+12 -9
+4 -1
internal/atproto/xrpc/client.go
··· 323 323 "documentURI": comment.DocumentURI, 324 324 "paragraphId": comment.ParagraphID, 325 325 "text": comment.Text, 326 - "author": comment.AuthorDID, 326 + "author": comment.Author, 327 327 } 328 328 uri, _, err := c.CreateRecord(collectionComment, record) 329 329 if err != nil { ··· 343 343 for _, r := range records { 344 344 var comment model.Comment 345 345 if err := json.Unmarshal(r.Value, &comment); err != nil { 346 + continue 347 + } 348 + if documentRKey != "" && comment.DocumentURI != "diffdown://document/"+documentRKey { 346 349 continue 347 350 } 348 351 comment.URI = r.URI
+1 -1
internal/handler/handler.go
··· 595 595 DocumentURI: fmt.Sprintf("at://%s/com.diffdown.document/%s", session.DID, rKey), 596 596 ParagraphID: req.ParagraphID, 597 597 Text: req.Text, 598 - AuthorDID: session.DID, 598 + Author: session.DID, 599 599 } 600 600 601 601 uri, err := client.CreateComment(comment)
+7 -7
internal/model/models.go
··· 67 67 } 68 68 69 69 type Comment struct { 70 - URI string `json:"uri"` 71 - DocumentURI string `json:"document_uri"` 72 - ParagraphID string `json:"paragraph_id"` 73 - Text string `json:"text"` 74 - AuthorDID string `json:"author_did"` 75 - AuthorName string `json:"author_name"` 76 - CreatedAt string `json:"created_at"` 70 + URI string `json:"uri"` 71 + DocumentURI string `json:"documentURI"` 72 + ParagraphID string `json:"paragraphId"` 73 + Text string `json:"text"` 74 + Author string `json:"author"` 75 + AuthorName string `json:"authorName"` 76 + CreatedAt time.Time `json:"createdAt"` 77 77 } 78 78 79 79 // RKeyFromURI extracts the rkey (last path segment) from an at:// URI.