(w http.ResponseWriter, r *http.Request)
| 349 | } |
| 350 | |
| 351 | func (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 |
nothing calls this directly
no test coverage detected