π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Merge main into server-comments
Manav Rathie0d39553f39e
diff --cc server/pkg/controller/mailing_lists.goindex b5c15b9922,1c6f3004e8..6983a2fe4d--- a/server/pkg/controller/mailing_lists.go+++ b/server/pkg/controller/mailing_lists.go@@@ -25,23 -18,8 +18,7 @@@ type MailingListsController structdiscordController *discord.DiscordController}-// Return a new instance of MailingListsControllerfunc NewMailingListsController(discordController *discord.DiscordController) *MailingListsController {- zohoCredentials := zoho.Credentials{- ClientID: viper.GetString("zoho.client-id"),- ClientSecret: viper.GetString("zoho.client-secret"),- RefreshToken: viper.GetString("zoho.refresh-token"),- }-- zohoListKey := viper.GetString("zoho.list-key")-- zohoTopicIds := viper.GetString("zoho.topic-ids")-- // Zoho has a rate limit on the number of access tokens that can created- // within a given time period. So as an aid in debugging, allow the access- // token to be passed in. This will not be present in production - there- // we'll use the refresh token to create an access token on demand.- zohoAccessToken := viper.GetString("zoho.access_token")-listmonkCredentials := listmonk.Credentials{BaseURL: viper.GetString("listmonk.server-url"),Username: viper.GetString("listmonk.username"),@@@ -113,10 -57,13 +54,6 @@@ func (c *MailingListsController) Unsubsreturn nil}- func (c *MailingListsController) shouldSkipZoho() bool {- return c.zohoCredentials.RefreshToken == ""- }--// shouldSkipListmonk() checks if the Listmonk mailing list-// should be skipped due to missing credentials-// listmonklistIDs value.-//-// ListmonkListIDs is an optional field for subscribing an email address-// (user gets added to the default list),-// but is a required field for unsubscribing an email addressfunc (c *MailingListsController) shouldSkipListmonk() bool {if c.listmonkCredentials.BaseURL == "" || c.listmonkCredentials.Username == "" ||c.listmonkCredentials.Password == "" || len(c.listmonkListIDs) == 0 {@@@ -125,51 -73,7 +62,6 @@@return false}- func (c *MailingListsController) doListActionZoho(action string, email string) error {- // Query escape the email so that any pluses get converted to %2B.- escapedEmail := url.QueryEscape(email)- contactInfo := fmt.Sprintf("{Contact+Email: \"%s\"}", escapedEmail)- // Instead of using QueryEscape, use PathEscape. QueryEscape escapes the "+"- // character, which causes Zoho API to not recognize the parameter.- escapedContactInfo := url.PathEscape(contactInfo)-- url := fmt.Sprintf(- "https://campaigns.zoho.com/api/v1.1/json/%s?resfmt=JSON&listkey=%s&contactinfo=%s&topic_id=%s",- action, c.zohoListKey, escapedContactInfo, c.zohoTopicIds)-- zohoAccessToken, err := zoho.DoRequest("POST", url, c.zohoAccessToken, c.zohoCredentials)- c.zohoAccessToken = zohoAccessToken-- if err != nil {- // This is not necessarily an error, and can happen when the customer- // had earlier unsubscribed from our organization emails in Zoho,- // selecting the "Erase my data" option. This causes Zoho to remove the- // customer's entire record from their database.- //- // Then later, say if the customer deletes their account from ente, we- // would try to unsubscribe their email but it wouldn't be present in- // Zoho, and this API call would've failed.- //- // In such a case, Zoho will return the following response:- //- // { code":"2103",- // "message":"Contact does not exist.",- // "version":"1.1",- // "uri":"/api/v1.1/json/listunsubscribe",- // "status":"error"}- //- // Special case these to reduce the severity level so as to not cause- // error log spam.- if strings.Contains(err.Error(), "Contact does not exist") {- log.Warnf("Zoho - Could not %s '%s': %s", action, email, err)- } else {- log.Errorf("Zoho - Could not %s '%s': %s", action, email, err)- }- }-- return stacktrace.Propagate(err, "")- }--// Subscribes an email address to a particular listmonk campaign mailing listfunc (c *MailingListsController) listmonkSubscribe(email string) error {data := map[string]interface{}{"email": email,