diff --git a/server/ente/offer.go b/server/ente/offer.go
index 4fcd3df554..0b230b24ce 100644
--- a/server/ente/offer.go
+++ b/server/ente/offer.go
@@ -11,3 +11,8 @@ type BlackFridayOffer struct {
}
type BlackFridayOfferPerCountry map[string][]BlackFridayOffer
+
+const (
+ BF2024EmailTemplate = "bf_2024.html"
+ BF2024EmailSubject = "Black Friday deal confirmation"
+)
diff --git a/server/mail-templates/bf_2024.html b/server/mail-templates/bf_2024.html
new file mode 100644
index 0000000000..922e09641d
--- /dev/null
+++ b/server/mail-templates/bf_2024.html
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
Congratulations on claiming a deal on Ente's last Black Friday sale!
+
+
Your account has been credited with {{.Storage}} of storage. Please note that you can share this with your family.
+
+
If you need help with anything, please write back!
+
+
+
+
+
diff --git a/server/pkg/controller/offer/offer.go b/server/pkg/controller/offer/offer.go
index ae2bb22ead..94235d74b3 100644
--- a/server/pkg/controller/offer/offer.go
+++ b/server/pkg/controller/offer/offer.go
@@ -5,6 +5,7 @@ import (
"database/sql"
"encoding/json"
"errors"
+ "fmt"
"os"
"github.com/ente-io/museum/pkg/controller/usercache"
@@ -17,6 +18,7 @@ import (
"github.com/ente-io/museum/pkg/utils/array"
"github.com/ente-io/museum/pkg/utils/billing"
"github.com/ente-io/museum/pkg/utils/config"
+ emailUtil "github.com/ente-io/museum/pkg/utils/email"
"github.com/ente-io/museum/pkg/utils/time"
"github.com/ente-io/stacktrace"
log "github.com/sirupsen/logrus"
@@ -114,6 +116,15 @@ func (c *OfferController) ApplyOffer(email string, productID string) error {
return stacktrace.Propagate(err, "")
}
go c.UserCacheCtrl.GetActiveStorageBonus(context.Background(), userID)
+ go emailUtil.SendTemplatedEmail([]string{email}, "Ente", "team@ente.io",
+ ente.BF2024EmailSubject,
+ ente.BF2024EmailTemplate, map[string]interface{}{
+ "Storage": c.readableStorage(offerToBeApplied.Storage),
+ }, nil)
c.DiscordController.NotifyBlackFridayUser(userID, offerToBeApplied.Price)
return nil
}
+
+func (c *OfferController) readableStorage(storage int64) string {
+ return fmt.Sprintf("%d GB", storage/(1<<30))
+}