a live task can be edited, a resolved one cannot (V-509)
SetTaskStatus was the only mutation on a task row, so a typo in a dictated task was permanent and a deadline could not move. EditTask rewrites the three fields capture set — text, due date and weight — and nothing else. Status stays the one-way ladder SetTaskStatus owns. Two things the task asked to settle. A text edit re-normalises the dedupe key and can collide with another live row. That is ErrTaskDuplicate, a refusal rather than a merge: two live rows carry two provenances, two capture times and possibly two external identities, and merging picks a winner for all three with nobody asked. The surface names the row that holds the text. A resolved task is refused outright (ErrTaskResolved). Its text is the record of what was finished, and rewriting it rewrites history. due nil clears the date, because clearing has to be sayable — an absent date and "remove the date" cannot be one argument.
This commit is contained in:
@@ -549,6 +549,16 @@ type setTaskStatusReq struct {
|
||||
By string `json:"by,omitempty"`
|
||||
}
|
||||
|
||||
// editTaskReq — the rewrite of the three fields capture set (Vikunja #509).
|
||||
// Due nil clears the date, so "no date given" and "remove the date" cannot be
|
||||
// the same request.
|
||||
type editTaskReq struct {
|
||||
ID int64 `json:"id"`
|
||||
Text string `json:"text"`
|
||||
Due *time.Time `json:"due,omitempty"`
|
||||
Weight int `json:"weight,omitempty"`
|
||||
}
|
||||
|
||||
// setTaskFieldsReq — the write for the two board columns. Both are sent every
|
||||
// time and both may be empty: clearing a blocker is as ordinary as setting one,
|
||||
// so an omitted field cannot mean "leave it alone" without a second way to say
|
||||
@@ -872,6 +882,13 @@ var ErrToolNotFound = errors.New("ipc: tool not found")
|
||||
// form can say which refusal it hit rather than "не найдено".
|
||||
var ErrTaskNoDoneWhen = errors.New("ipc: task has no definition of done")
|
||||
|
||||
// ErrTaskDuplicate — an edit would collide with another live task's normalised
|
||||
// text (Vikunja #509). The surface says which row holds it rather than merging.
|
||||
var ErrTaskDuplicate = errors.New("ipc: another live task already has this text")
|
||||
|
||||
// ErrTaskResolved — a resolved task is not editable.
|
||||
var ErrTaskResolved = errors.New("ipc: task is resolved")
|
||||
|
||||
// callerKey — context key for the authenticated caller. Server sets it from
|
||||
// SO_PEERCRED before dispatch; in-process callers omit it (the adapter treats
|
||||
// a missing Caller as "trusted same-process", the equivalent of the socket's
|
||||
|
||||
Reference in New Issue
Block a user