diff --git a/main.go b/main.go index aa58329..d5fb39c 100644 --- a/main.go +++ b/main.go @@ -437,6 +437,8 @@ func handleMessageRoutes(w http.ResponseWriter, r *http.Request) { handleToDocs(w, r, messageID) case "attachments": handleAttachments(w, r, messageID) + case "seen": + handleSeen(w, r, messageID) default: http.Error(w, "Unknown action", http.StatusNotFound) } @@ -474,6 +476,19 @@ func handleArchive(w http.ResponseWriter, r *http.Request, id string) { json.NewEncoder(w).Encode(map[string]string{"status": "archived"}) } +// POST /messages/{id}/seen - mark as seen without archiving/deleting +// Removes from /messages/new but keeps message in its original mailbox +func handleSeen(w http.ResponseWriter, r *http.Request, id string) { + if r.Method != "POST" { + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + return + } + + orch.RecordAction(id, "seen") + + json.NewEncoder(w).Encode(map[string]string{"status": "seen"}) +} + func handleDelete(w http.ResponseWriter, r *http.Request, id string) { if r.Method != "POST" { http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)