π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Skip storage warnings on self-hosted
Neeraj Gupta664142244ad1
diff --git a/server/pkg/controller/email/storage_warning.go b/server/pkg/controller/email/storage_warning.goindex a94f424cc7..e620841567 100644--- a/server/pkg/controller/email/storage_warning.go+++ b/server/pkg/controller/email/storage_warning.go@@ -172,6 +172,10 @@ func (c *EmailNotificationController) SendStorageWarningMails() {log.Error("Skipping storage warning mails: controller dependencies are not fully configured")return}+ if c.UserRepo.IsLikelySelfHosted() {+ return+ }+ log.Info("Running storage warning mails for cloud instance")lockStatus := c.LockController.TryLock(StorageWarningMailLock, time.MicrosecondsAfterHours(24))if !lockStatus {diff --git a/server/pkg/repo/user.go b/server/pkg/repo/user.goindex 1c9120bf77..09b2e3659b 100644--- a/server/pkg/repo/user.go+++ b/server/pkg/repo/user.go@@ -81,6 +81,16 @@ func (repo *UserRepository) GetUserByIDInternal(id int64) (ente.User, error) {return user, nil}+// Return true if userId 1 doesn't exists in the system.+func (repo *UserRepository) IsLikelySelfHosted() bool {+ var userOneExists bool+ if err := repo.DB.QueryRow(`SELECT EXISTS(SELECT 1 FROM users WHERE user_id = 1)`).Scan(&userOneExists); err != nil {+ return false+ }++ return !userOneExists+}+// Delete removes the email_hash and encrypted email information for the user. It replaces email_hash with placeholder value// based on DELETED_EMAIL_HASH_FORMATfunc (repo *UserRepository) Delete(userID int64) error {