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

Method appDeleteComment

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

Source from the content-addressed store, hash-verified

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