forked from Silverfish/proton-bridge
fix(GODT-2774): only check telemetry availability for the current user.
This commit is contained in:
@ -297,8 +297,7 @@ func (bridge *Bridge) SetColorScheme(colorScheme string) error {
|
||||
// Note: it does not clear the keychain. The only entry in the keychain is the vault password,
|
||||
// which we need at next startup to decrypt the vault.
|
||||
func (bridge *Bridge) FactoryReset(ctx context.Context) {
|
||||
useTelemetry := bridge.IsTelemetryAvailable(ctx)
|
||||
|
||||
useTelemetry := !bridge.GetTelemetryDisabled()
|
||||
// Delete all the users.
|
||||
safe.Lock(func() {
|
||||
for _, user := range bridge.users {
|
||||
|
||||
@ -243,15 +243,13 @@ func (bridge *Bridge) LogoutUser(ctx context.Context, userID string) error {
|
||||
func (bridge *Bridge) DeleteUser(ctx context.Context, userID string) error {
|
||||
logrus.WithField("userID", userID).Info("Deleting user")
|
||||
|
||||
useTelemetry := bridge.IsTelemetryAvailable(ctx)
|
||||
|
||||
return safe.LockRet(func() error {
|
||||
if !bridge.vault.HasUser(userID) {
|
||||
return ErrNoSuchUser
|
||||
}
|
||||
|
||||
if user, ok := bridge.users[userID]; ok {
|
||||
bridge.logoutUser(ctx, user, true, true, useTelemetry)
|
||||
bridge.logoutUser(ctx, user, true, true, !bridge.GetTelemetryDisabled())
|
||||
}
|
||||
|
||||
if err := bridge.vault.DeleteUser(userID); err != nil {
|
||||
|
||||
@ -30,7 +30,7 @@ func (user *User) SendConfigStatusSuccess(ctx context.Context) {
|
||||
user.SendConfigStatusRecovery(ctx)
|
||||
return
|
||||
}
|
||||
if !user.telemetryManager.IsTelemetryAvailable(ctx) {
|
||||
if !user.IsTelemetryEnabled(ctx) {
|
||||
return
|
||||
}
|
||||
if !user.configStatus.IsPending() {
|
||||
@ -65,7 +65,7 @@ func (user *User) SendConfigStatusAbort(ctx context.Context, withTelemetry bool)
|
||||
if !user.configStatus.IsPending() {
|
||||
return
|
||||
}
|
||||
if !withTelemetry {
|
||||
if !withTelemetry || !user.IsTelemetryEnabled(ctx) {
|
||||
return
|
||||
}
|
||||
var builder configstatus.ConfigAbortBuilder
|
||||
@ -90,7 +90,7 @@ func (user *User) SendConfigStatusRecovery(ctx context.Context) {
|
||||
user.SendConfigStatusSuccess(ctx)
|
||||
return
|
||||
}
|
||||
if !user.telemetryManager.IsTelemetryAvailable(ctx) {
|
||||
if !user.IsTelemetryEnabled(ctx) {
|
||||
return
|
||||
}
|
||||
if !user.configStatus.IsPending() {
|
||||
@ -118,7 +118,7 @@ func (user *User) SendConfigStatusRecovery(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (user *User) SendConfigStatusProgress(ctx context.Context) {
|
||||
if !user.telemetryManager.IsTelemetryAvailable(ctx) {
|
||||
if !user.IsTelemetryEnabled(ctx) {
|
||||
return
|
||||
}
|
||||
if !user.configStatus.IsPending() {
|
||||
|
||||
Reference in New Issue
Block a user