Hub v0.6.1: delete issues from UI + fingerprint hardening
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -130,6 +130,57 @@ func (s *Server) handleResetAppTelemetry(w http.ResponseWriter, r *http.Request,
|
||||
http.Redirect(w, r, target, http.StatusSeeOther)
|
||||
}
|
||||
|
||||
// handleDeleteAppIssues handles POST requests to delete selected or all issues for an app.
|
||||
func (s *Server) handleDeleteAppIssues(w http.ResponseWriter, r *http.Request, appName string) {
|
||||
action := r.FormValue("action")
|
||||
|
||||
var deletedCount int64
|
||||
var err error
|
||||
|
||||
switch action {
|
||||
case "all":
|
||||
deletedCount, err = s.store.DeleteAppIssues(appName)
|
||||
case "selected":
|
||||
r.ParseForm()
|
||||
idStrs := r.Form["issue_ids"]
|
||||
if len(idStrs) == 0 {
|
||||
period := r.URL.Query().Get("period")
|
||||
target := "/apps/" + appName + "?flash=no_issues_selected"
|
||||
if period != "" {
|
||||
target += "&period=" + period
|
||||
}
|
||||
http.Redirect(w, r, target, http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
ids := make([]int, 0, len(idStrs))
|
||||
for _, s := range idStrs {
|
||||
id, err := strconv.Atoi(s)
|
||||
if err == nil && id > 0 {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
deletedCount, err = s.store.DeleteAppIssuesByIDs(ids)
|
||||
default:
|
||||
http.Error(w, "Invalid action", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
s.logger.Printf("[ERROR] Failed to delete issues for %s: %v", appName, err)
|
||||
http.Error(w, "Internal error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
s.logger.Printf("[INFO] Deleted %d issues for %s (action=%s)", deletedCount, appName, action)
|
||||
|
||||
period := r.URL.Query().Get("period")
|
||||
target := "/apps/" + appName + "?flash=issues_deleted"
|
||||
if period != "" {
|
||||
target += "&period=" + period
|
||||
}
|
||||
http.Redirect(w, r, target, http.StatusSeeOther)
|
||||
}
|
||||
|
||||
// parsePeriod converts a period string to a time.Time cutoff.
|
||||
func parsePeriod(s string, defaultDur time.Duration) time.Time {
|
||||
switch s {
|
||||
|
||||
Reference in New Issue
Block a user