Skip to content

Commit fcfad36

Browse files
authored
fix/users: remove query for usageStatistics (#1264)
This field was deprecated in March last year and was removed November last year. Before this change any user subcommand just failed. Will be adding some integration smoke tests to catch these sort of issues. Additionally found one place we didn't set Content-Type which Sourcegraph also recently started enforcing.
1 parent e9c26fb commit fcfad36

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

cmd/src/users.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ fragment UserFields on User {
6060
email
6161
verified
6262
}
63-
usageStatistics {
64-
lastActiveTime
65-
lastActiveCodeHostIntegrationTime
66-
}
6763
url
6864
}
6965
`
@@ -76,21 +72,15 @@ type User struct {
7672
Organizations struct {
7773
Nodes []Org
7874
}
79-
Emails []UserEmail
80-
UsageStatistics UserUsageStatistics
81-
URL string
75+
Emails []UserEmail
76+
URL string
8277
}
8378

8479
type UserEmail struct {
8580
Email string
8681
Verified bool
8782
}
8883

89-
type UserUsageStatistics struct {
90-
LastActiveTime string
91-
LastActiveCodeHostIntegrationTime string
92-
}
93-
9484
type SiteUser struct {
9585
ID string
9686
Username string

internal/users/admin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func (c *Client) GraphQL(token, query string, variables map[string]any, target a
252252
if err != nil {
253253
return err
254254
}
255+
req.Header.Set("Content-Type", "application/json")
255256
if token != "" {
256257
req.Header.Set("Authorization", fmt.Sprintf("token %s", token))
257258
} else {

0 commit comments

Comments
 (0)