Skip to content

Commit

Permalink
Changed the value of the anonymous user id
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFaucherre committed Aug 1, 2023
1 parent a1491d1 commit c71d485
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions cmd/create_telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ import (
)

var (
CreateUUID = func() string { return uuid.New().String() }
isStdinATTY = term.IsTerminal(int(os.Stdin.Fd()))
CreateUUID = func() string { return uuid.New().String() }
isStdinATTY = term.IsTerminal(int(os.Stdin.Fd()))
anonymousUser = telemetry.User{
UniqueID: "cli-anonymous-telemetry",
}
)

type telemetryUI interface {
Expand Down Expand Up @@ -125,9 +128,7 @@ func loadTelemetrySettings(settings *settings.TelemetrySettings, user *telemetry
// If stdin is not available, send telemetry event, disable telemetry and return
if !isStdinATTY {
settings.IsEnabled = false
err := telemetry.SendTelemetryApproval(telemetry.User{
UniqueID: settings.UniqueID,
}, telemetry.NoStdin)
err := telemetry.SendTelemetryApproval(anonymousUser, telemetry.NoStdin)
if err != nil {
fmt.Printf("Error while sending telemetry approval %s\n", err)
}
Expand Down Expand Up @@ -158,7 +159,7 @@ func loadTelemetrySettings(settings *settings.TelemetrySettings, user *telemetry
}
user.UserID = settings.UserID
} else {
*user = telemetry.User{}
*user = anonymousUser
}

// Send telemetry approval event
Expand Down
2 changes: 1 addition & 1 deletion telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func newSegmentClient(user User) Client {
}

if len(user.UniqueID) == 0 {
user.UniqueID = "null"
return CreateNullClient()
}

err = cli.Enqueue(
Expand Down

0 comments on commit c71d485

Please sign in to comment.