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

Record collaboration row when invite is accepted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

+6
+6
internal/handler/handler.go
··· 639 639 // Already a collaborator — redirect to the owner-scoped URL. 640 640 for _, c := range doc.Collaborators { 641 641 if c == collabSession.DID { 642 + h.DB.AddCollaboration(collabSession.DID, invite.CreatedBy, rKey) // ensure row exists 642 643 http.Redirect(w, r, "/docs/"+invite.CreatedBy+"/"+rKey, http.StatusSeeOther) 643 644 return 644 645 } ··· 653 654 } 654 655 655 656 h.DB.DeleteInvite(invite.Token) 657 + 658 + if err := h.DB.AddCollaboration(collabSession.DID, invite.CreatedBy, rKey); err != nil { 659 + log.Printf("AcceptInvite: record collaboration: %v", err) 660 + // Non-fatal — collaborator is already on the document, just redirect. 661 + } 656 662 657 663 // Redirect to owner-scoped document URL so the view handler knows whose PDS to query. 658 664 http.Redirect(w, r, "/docs/"+invite.CreatedBy+"/"+rKey, http.StatusSeeOther)