diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-08-13 08:38:29 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-08-13 08:38:29 +0000 |
| commit | a03d7673e7adf9a575c7272b2b528a74b230535e (patch) | |
| tree | a4ac635d92eade4df117db2a4fbdfe1eff13d677 /internal/handlers/handlers.go | |
| parent | 2509dde6aa372a505b186657706f4d21bd391807 (diff) | |
Fix blank task-detail modal for Google Tasks
loadTaskDetailData/HandleUpdateTask only had cases for "trello" and
"doot" sources, so opening a gtask from the Tasks or Timeline tab
rendered an empty title/description. Reuses the existing
findGoogleTask cache lookup for both. Renamed the API client's
UpdateTaskNotes to UpdateTask(title, notes) so the web modal can save
an edited title too, not just description; the widget's
description-only edit popup now just round-trips the task's existing
title unchanged.
Diffstat (limited to 'internal/handlers/handlers.go')
| -rw-r--r-- | internal/handlers/handlers.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 30aaf67..7220474 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -832,6 +832,10 @@ func (h *Handler) loadTaskDetailData(id, source string) taskDetailData { data.RecurrenceInterval = task.RecurrenceInterval data.RecurrenceWeekdays = task.RecurrenceWeekdays } + case "gtasks": + if t, ok := h.findGoogleTask(id); ok { + data.Title, data.Description = t.Title, t.Notes + } } return data } @@ -975,6 +979,24 @@ func (h *Handler) HandleUpdateTask(w http.ResponseWriter, r *http.Request) { updates["name"] = title } err = h.trelloClient.UpdateCard(r.Context(), id, updates) + case "gtasks": + if h.googleTasksClient == nil { + JSONError(w, http.StatusServiceUnavailable, "Google Tasks not configured", nil) + return + } + t, ok := h.findGoogleTask(id) + if !ok { + JSONError(w, http.StatusNotFound, "task not found", nil) + return + } + saveTitle := title + if saveTitle == "" { + saveTitle = t.Title + } + err = h.googleTasksClient.UpdateTask(r.Context(), t.ListID, id, saveTitle, description) + if err == nil { + _ = h.store.InvalidateCache(store.CacheKeyGoogleTasks) + } default: JSONError(w, http.StatusBadRequest, "Unknown source", nil) return |
