Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Fix: use DefaultActive for unspecified contact status in import process

lotkbcac2ca96933
diff --git a/core/internal/controller/contact/contact_v1_import_contacts.go b/core/internal/controller/contact/contact_v1_import_contacts.go
index 6cc46252..c26b099b 100644
--- a/core/internal/controller/contact/contact_v1_import_contacts.go
+++ b/core/internal/controller/contact/contact_v1_import_contacts.go
@@ -12,11 +12,12 @@ import (
"encoding/csv"
"encoding/json"
"fmt"
+ "io"
+ "strings"
+
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gvalid"
- "io"
- "strings"
)
const (
@@ -294,9 +295,10 @@ func (c *ControllerV1) ImportContacts(ctx context.Context, req *v1.ImportContact
continue
}
- //if contactInfo.Active == -1 {
- // contactInfo.Active = req.DefaultActive
- //}
+ // Fix: If "active" is not explicitly specified, then use "DefaultActive" as specified in the request.
+ if c.Active == 1 {
+ contactInfo.Active = req.DefaultActive
+ }
contactInfo.Status = req.Status
groupContacts = append(groupContacts, &contactInfo)