Refine task editor layout and personal reminder defaults
This commit is contained in:
1 parent
8fd0b6ec8b
commit
a6bf3dfe41
14 files changed
+263
-26
No files matched your search
@@ -34,9 +34,21 @@ func defaultTask(p store.TaskPreferences, now time.Time) store.TaskRecord {
|
||||
*date.target = now.AddDate(0, 0, *date.offset).Format("2006-01-02")
|
||||
}
|
||||
}
|
||||
applyTaskReminderDefaults(&item, p)
|
||||
return item
|
||||
}
|
||||
|
||||
// Undated captures must remain possible, even when reminder defaults are on.
|
||||
// Apply after date overrides, and never apply to updates of existing tasks.
|
||||
func applyTaskReminderDefaults(item *store.TaskRecord, p store.TaskPreferences) {
|
||||
item.NotifyDue = p.NotifyDue && item.DueOn != ""
|
||||
item.NotifyPlanned = p.NotifyPlanned && item.PlannedOn != ""
|
||||
item.ReminderTime = p.ReminderTime
|
||||
if item.ReminderTime == "" {
|
||||
item.ReminderTime = "09:00"
|
||||
}
|
||||
}
|
||||
|
||||
type taskCaptureInput struct {
|
||||
RequestID string `json:"request_id"`
|
||||
Title string `json:"title"`
|
||||
@@ -198,6 +210,7 @@ func (s *Server) handleTaskProductivity(w http.ResponseWriter, r *http.Request,
|
||||
if input.Complexity != nil {
|
||||
item.Complexity = *input.Complexity
|
||||
}
|
||||
applyTaskReminderDefaults(&item, p)
|
||||
raw, _ := json.Marshal(input)
|
||||
hash := sha256.Sum256(raw)
|
||||
item, err = s.store.CaptureTask(r.Context(), domain, actor, input.RequestID, hex.EncodeToString(hash[:]), item)
|
||||
|
||||
Reference in new issue
Block a user