π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Alert on Listmonk failures
vishnukvmd6c2b7143a47b
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.goindex 519da4858c..683f3d2240 100644--- a/server/cmd/museum/main.go+++ b/server/cmd/museum/main.go@@ -231,7 +231,7 @@ func main() {}pushController := controller.NewPushController(pushRepo, taskLockingRepo, hostName)- mailingListsController := controller.NewMailingListsController()+ mailingListsController := controller.NewMailingListsController(discordController)storageBonusCtrl := &storagebonus.Controller{UserRepo: userRepo,diff --git a/server/pkg/controller/mailing_lists.go b/server/pkg/controller/mailing_lists.goindex 7d2761603a..5d10c0c14f 100644--- a/server/pkg/controller/mailing_lists.go+++ b/server/pkg/controller/mailing_lists.go@@ -6,6 +6,7 @@ import ("strconv""strings"+ "github.com/ente-io/museum/pkg/controller/discord""github.com/ente-io/museum/pkg/external/listmonk""github.com/ente-io/museum/pkg/external/zoho""github.com/ente-io/stacktrace"@@ -28,10 +29,11 @@ type MailingListsController struct {zohoCredentials zoho.CredentialslistmonkListIDs []intlistmonkCredentials listmonk.Credentials+ discordController *discord.DiscordController}// Return a new instance of MailingListsController-func NewMailingListsController() *MailingListsController {+func NewMailingListsController(discordController *discord.DiscordController) *MailingListsController {zohoCredentials := zoho.Credentials{ClientID: viper.GetString("zoho.client-id"),ClientSecret: viper.GetString("zoho.client-secret"),@@ -77,6 +79,7 @@ func NewMailingListsController() *MailingListsController {zohoAccessToken: zohoAccessToken,listmonkCredentials: listmonkCredentials,listmonkListIDs: listmonkListIDs,+ discordController: discordController,}}@@ -216,6 +219,7 @@ func (c *MailingListsController) listmonkSubscribe(email string) error {c.listmonkCredentials.Username, c.listmonkCredentials.Password)if err != nil {log.Errorf("Listmonk - Could not subscribe '%s': %s", email, err)+ c.notifyListmonkFailure("Listmonk subscribe failed")}return err}@@ -231,6 +235,7 @@ func (c *MailingListsController) listmonkUnsubscribe(email string) error {c.listmonkCredentials.Username, c.listmonkCredentials.Password, email)if err != nil {log.Errorf("Listmonk - Could not find subscriber '%s': %s", email, err)+ c.notifyListmonkFailure("Listmonk subscriber lookup failed")return stacktrace.Propagate(err, "")}@@ -238,6 +243,14 @@ func (c *MailingListsController) listmonkUnsubscribe(email string) error {map[string]interface{}{}, c.listmonkCredentials.Username, c.listmonkCredentials.Password)if err != nil {log.Errorf("Listmonk - Could not unsubscribe '%s': %s", email, err)+ c.notifyListmonkFailure("Listmonk unsubscribe failed")}return err}++func (c *MailingListsController) notifyListmonkFailure(message string) {+ if c.discordController == nil {+ return+ }+ c.discordController.Notify(message)+}