MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / magicReject

Method magicReject

internal/agent/hitl_magic_api.go:248–270  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, messageID, userID, reason string)

Source from the content-addressed store, hash-verified

246}
247
248func (a *API) magicReject(w http.ResponseWriter, r *http.Request, messageID, userID, reason string) {
249 rejected, err := a.store.RejectPending(r.Context(), messageID, userID, reason)
250 if err != nil {
251 switch {
252 case errors.Is(err, identity.ErrMessageNotFound):
253 writeMagicMessage(w, http.StatusNotFound, "Message not found",
254 "This message no longer exists.")
255 case errors.Is(err, identity.ErrNotPendingApproval):
256 writeMagicMessage(w, http.StatusConflict, "Already resolved",
257 "This message has already been approved, rejected, or expired.")
258 default:
259 log.Printf("[api] magic-reject failed: msg=%s err=%v", messageID, err)
260 writeMagicMessage(w, http.StatusInternalServerError, "Rejection failed",
261 "We couldn't reject this message. Try again from the dashboard.")
262 }
263 return
264 }
265 log.Printf("[mail:%s] dir=outbound type=%s status=%s rejected_by=magic-link:user:%s reason=%q",
266 rejected.ID, rejected.Type, rejected.Status, userID, reason)
267
268 writeMagicMessage(w, http.StatusOK, "Rejected",
269 "The message has been discarded and will not be sent.")
270}
271
272// --- HTML rendering ---
273//

Callers 1

Calls 2

writeMagicMessageFunction · 0.85
RejectPendingMethod · 0.80

Tested by

no test coverage detected