mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-23 02:26:42 +00:00
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,
|
// 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.
|
// which we need at next startup to decrypt the vault.
|
||||||
func (bridge *Bridge) FactoryReset(ctx context.Context) {
|
func (bridge *Bridge) FactoryReset(ctx context.Context) {
|
||||||
useTelemetry := bridge.IsTelemetryAvailable(ctx)
|
useTelemetry := !bridge.GetTelemetryDisabled()
|
||||||
|
|
||||||
// Delete all the users.
|
// Delete all the users.
|
||||||
safe.Lock(func() {
|
safe.Lock(func() {
|
||||||
for _, user := range bridge.users {
|
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 {
|
func (bridge *Bridge) DeleteUser(ctx context.Context, userID string) error {
|
||||||
logrus.WithField("userID", userID).Info("Deleting user")
|
logrus.WithField("userID", userID).Info("Deleting user")
|
||||||
|
|
||||||
useTelemetry := bridge.IsTelemetryAvailable(ctx)
|
|
||||||
|
|
||||||
return safe.LockRet(func() error {
|
return safe.LockRet(func() error {
|
||||||
if !bridge.vault.HasUser(userID) {
|
if !bridge.vault.HasUser(userID) {
|
||||||
return ErrNoSuchUser
|
return ErrNoSuchUser
|
||||||
}
|
}
|
||||||
|
|
||||||
if user, ok := bridge.users[userID]; ok {
|
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 {
|
if err := bridge.vault.DeleteUser(userID); err != nil {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ func (user *User) SendConfigStatusSuccess(ctx context.Context) {
|
|||||||
user.SendConfigStatusRecovery(ctx)
|
user.SendConfigStatusRecovery(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.telemetryManager.IsTelemetryAvailable(ctx) {
|
if !user.IsTelemetryEnabled(ctx) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.configStatus.IsPending() {
|
if !user.configStatus.IsPending() {
|
||||||
@ -65,7 +65,7 @@ func (user *User) SendConfigStatusAbort(ctx context.Context, withTelemetry bool)
|
|||||||
if !user.configStatus.IsPending() {
|
if !user.configStatus.IsPending() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !withTelemetry {
|
if !withTelemetry || !user.IsTelemetryEnabled(ctx) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var builder configstatus.ConfigAbortBuilder
|
var builder configstatus.ConfigAbortBuilder
|
||||||
@ -90,7 +90,7 @@ func (user *User) SendConfigStatusRecovery(ctx context.Context) {
|
|||||||
user.SendConfigStatusSuccess(ctx)
|
user.SendConfigStatusSuccess(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.telemetryManager.IsTelemetryAvailable(ctx) {
|
if !user.IsTelemetryEnabled(ctx) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.configStatus.IsPending() {
|
if !user.configStatus.IsPending() {
|
||||||
@ -118,7 +118,7 @@ func (user *User) SendConfigStatusRecovery(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (user *User) SendConfigStatusProgress(ctx context.Context) {
|
func (user *User) SendConfigStatusProgress(ctx context.Context) {
|
||||||
if !user.telemetryManager.IsTelemetryAvailable(ctx) {
|
if !user.IsTelemetryEnabled(ctx) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.configStatus.IsPending() {
|
if !user.configStatus.IsPending() {
|
||||||
|
|||||||
Reference in New Issue
Block a user