diff options
author | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-07 03:02:21 -0400 |
---|---|---|
committer | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-07 03:02:21 -0400 |
commit | a3fa964c585f62ccf4c4113da1dc324839122c88 (patch) | |
tree | f189f84015d8327d5d6bc7fb1b97f4362d0be2ec /internal/notifier | |
parent | 17326a16a018ae84d274be53b52be9273ef69932 (diff) | |
download | donetick-a3fa964c585f62ccf4c4113da1dc324839122c88.tar.gz donetick-a3fa964c585f62ccf4c4113da1dc324839122c88.tar.bz2 donetick-a3fa964c585f62ccf4c4113da1dc324839122c88.zip |
Fix Adaptive Scheduler, Update email handlers, telegram notifications
Diffstat (limited to '')
-rw-r--r-- | internal/notifier/service/planner.go | 9 | ||||
-rw-r--r-- | internal/notifier/telegram/telegram.go | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/internal/notifier/service/planner.go b/internal/notifier/service/planner.go index 22502ab..05d600d 100644 --- a/internal/notifier/service/planner.go +++ b/internal/notifier/service/planner.go @@ -48,6 +48,9 @@ func (n *NotificationPlanner) GenerateNotifications(c context.Context, chore *ch var mt *chModel.NotificationMetadata if err := json.Unmarshal([]byte(*chore.NotificationMetadata), &mt); err != nil { log.Error("Error unmarshalling notification metadata", err) + return false + } + if chore.NextDueDate == nil { return true } if mt.DueDate { @@ -83,7 +86,7 @@ func generateDueNotifications(chore *chModel.Chore, users []*cModel.UserCircleDe TypeID: 1, UserID: user.ID, TargetID: fmt.Sprint(user.ChatID), - Text: fmt.Sprintf("📅 Reminder: '%s' is due today and assigned to %s.", chore.Name, assignee.DisplayName), + Text: fmt.Sprintf("📅 Reminder: *%s* is due today and assigned to %s.", chore.Name, assignee.DisplayName), } notifications = append(notifications, notification) } @@ -109,7 +112,7 @@ func generatePreDueNotifications(chore *chModel.Chore, users []*cModel.UserCircl TypeID: 3, UserID: user.ID, TargetID: fmt.Sprint(user.ChatID), - Text: fmt.Sprintf("📢 Heads up! Chore '%s' is due soon (on %s) and assigned to %s.", chore.Name, chore.NextDueDate.Format("January 2nd"), assignee.DisplayName), + Text: fmt.Sprintf("📢 Heads up! *%s* is due soon (on %s) and assigned to %s.", chore.Name, chore.NextDueDate.Format("January 2nd"), assignee.DisplayName), } notifications = append(notifications, notification) @@ -138,7 +141,7 @@ func generateOverdueNotifications(chore *chModel.Chore, users []*cModel.UserCirc TypeID: 2, UserID: user.ID, TargetID: fmt.Sprint(user.ChatID), - Text: fmt.Sprintf("🚨 '%s' is now %d hours overdue. Please complete it as soon as possible. (Assigned to %s)", chore.Name, hours, assignee.DisplayName), + Text: fmt.Sprintf("🚨 *%s* is now %d hours overdue. Please complete it as soon as possible. (Assigned to %s)", chore.Name, hours, assignee.DisplayName), } notifications = append(notifications, notification) } diff --git a/internal/notifier/telegram/telegram.go b/internal/notifier/telegram/telegram.go index e35f0c8..54c0905 100644 --- a/internal/notifier/telegram/telegram.go +++ b/internal/notifier/telegram/telegram.go @@ -55,7 +55,7 @@ func (tn *TelegramNotifier) SendChoreCompletion(c context.Context, chore *chMode if user.ChatID == 0 { continue } - text := fmt.Sprintf("🎉 '%s' is completed! is off the list, %s! 🌟 ", chore.Name, user.DisplayName) + text := fmt.Sprintf("🎉 *%s* is completed! is off the list, %s! 🌟 ", chore.Name, user.DisplayName) msg := tgbotapi.NewMessage(user.ChatID, text) msg.ParseMode = "Markdown" _, err := tn.bot.Send(msg) |