MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / appDeleteComment

Method appDeleteComment

internal/server/app_api_write.go:351–372  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

349}
350
351func (s *Server) appDeleteComment(w http.ResponseWriter, r *http.Request) {
352 ac := appContextFrom(r)
353 item, _, comment, ok := s.appCommentOnItem(w, r)
354 if !ok {
355 return
356 }
357 if !s.appReadmitBeforeWrite(w, r, item.ID, item.CollectionID) {
358 return
359 }
360 as, err := s.appStore()
361 if err != nil {
362 writeInternalError(w, err)
363 return
364 }
365 // Author only; refused if the comment's ancestor chain leaves the item.
366 // The human path publishes no SSE on delete, and neither does this one.
367 if err := as.DeleteComment(r.Context(), ac.appFenceSpec(), item.ID, comment.ID, appActor(ac)); err != nil {
368 writeAppStoreError(w, err)
369 return
370 }
371 w.WriteHeader(http.StatusNoContent)
372}
373
374// appReadmitBeforeWrite re-admits a write after its body is read and before
375// its write, and reports false after answering: a body can

Callers

nothing calls this directly

Calls 10

appCommentOnItemMethod · 0.95
appReadmitBeforeWriteMethod · 0.95
appStoreMethod · 0.95
appContextFromFunction · 0.85
writeInternalErrorFunction · 0.85
appActorFunction · 0.85
writeAppStoreErrorFunction · 0.85
appFenceSpecMethod · 0.80
DeleteCommentMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected