chore: optimize code

This commit is contained in:
killerprojecte
2026-06-22 20:20:44 +08:00
parent 77187e76ce
commit c8dff253cc
2 changed files with 17 additions and 12 deletions
+1 -1
View File
@@ -238,7 +238,7 @@ func (a *App) handleDeleteMailLabel(w http.ResponseWriter, r *http.Request) {
return
}
defer tx.Rollback()
if _, err := tx.ExecContext(ctx, "DELETE FROM message_labels WHERE label_id = ? AND EXISTS (SELECT 1 FROM mail_labels WHERE id = ? AND mailbox_id = ?)", labelID, labelID, mb.ID); err != nil {
if _, err := tx.ExecContext(ctx, "DELETE FROM message_labels WHERE label_id = ?", labelID); err != nil {
respondError(w, http.StatusInternalServerError, "failed to remove label associations")
return
}