Skip to content

Commit abed3d8

Browse files
committed
fix(calendar): hide cancelled events in list output (#362) (thanks @sharukh010)
1 parent d2acfa4 commit abed3d8

3 files changed

Lines changed: 42 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- Google API: use transport-level response-header timeouts for API clients while keeping token exchanges bounded, so large downloads are not cut short by `http.Client.Timeout`. (#425) — thanks @laihenyi.
1818
- Auth: keep Keep-only service-account fallback isolated to Keep commands so other Google services do not accidentally pick it up. (#414) — thanks @jgwesterlund.
1919
- Contacts: send the required `copyMask` when deleting "other contacts", avoiding People API 400 errors. (#384) — thanks @rbansal42.
20+
- Calendar: hide cancelled/deleted events from `calendar events` list output by explicitly setting `showDeleted=false`. (#362) — thanks @sharukh010.
2021
- Gmail: add a fetch delay in `watch serve` so History API reads don't race message indexing. (#397) — thanks @salmonumbrella.
2122
- Gmail: allow Workspace-managed send-as aliases with empty verification status in `send` and `drafts create`. (#407) — thanks @salmonumbrella.
2223
- Gmail: preserve the selected `--client` during `watch serve` push handling instead of falling back to the default client. (#411) — thanks @chrysb.

internal/cmd/calendar_list_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package cmd
2+
3+
import (
4+
"context"
5+
"encoding/json"
6+
"net/http"
7+
"net/http/httptest"
8+
"testing"
9+
10+
"google.golang.org/api/calendar/v3"
11+
"google.golang.org/api/option"
12+
)
13+
14+
func TestCalendarEventsListCall_HidesCancelledEvents(t *testing.T) {
15+
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
16+
if got := r.URL.Query().Get("showDeleted"); got != "false" {
17+
t.Fatalf("expected showDeleted=false, got %q", got)
18+
}
19+
if got := r.URL.Query().Get("singleEvents"); got != "true" {
20+
t.Fatalf("expected singleEvents=true, got %q", got)
21+
}
22+
23+
w.Header().Set("Content-Type", "application/json")
24+
_ = json.NewEncoder(w).Encode(map[string]any{"items": []any{}})
25+
}))
26+
defer srv.Close()
27+
28+
svc, err := calendar.NewService(context.Background(),
29+
option.WithHTTPClient(srv.Client()),
30+
option.WithEndpoint(srv.URL+"/"),
31+
option.WithoutAuthentication(),
32+
)
33+
if err != nil {
34+
t.Fatalf("NewService: %v", err)
35+
}
36+
37+
if _, err := calendarEventsListCall(context.Background(), svc, "primary", "2026-01-01T00:00:00Z", "2026-01-02T00:00:00Z", 10, "", "", "", "", "").Do(); err != nil {
38+
t.Fatalf("Do: %v", err)
39+
}
40+
}

internal/cmd/docs_sed_brace.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func parseBraceKeyValue(key, val string, expr *braceExpr) error {
287287
case "y", "yes", boolTrue, "1":
288288
t := true
289289
expr.Check = &t
290-
case "n", "no", "false", "0":
290+
case "n", "no", boolFalse, "0":
291291
f := false
292292
expr.Check = &f
293293
}

0 commit comments

Comments
 (0)