Fix recurring tasks losing name and subtasks on status change (#886)
This commit is contained in:
parent
96db8c1362
commit
edc9d214f6
2 changed files with 12 additions and 7 deletions
|
|
@ -70,16 +70,14 @@ function buildUpdateAttributes(body, task, timezone) {
|
|||
(task.recurrence_type === 'none' || !task.recurrence_type);
|
||||
|
||||
const attrs = {
|
||||
name: body.name,
|
||||
name: body.name !== undefined ? body.name : task.name,
|
||||
priority:
|
||||
body.priority !== undefined
|
||||
? parsePriority(body.priority)
|
||||
: undefined,
|
||||
: task.priority,
|
||||
status:
|
||||
body.status !== undefined
|
||||
? parseStatus(body.status)
|
||||
: Task.STATUS.NOT_STARTED,
|
||||
note: body.note,
|
||||
body.status !== undefined ? parseStatus(body.status) : task.status,
|
||||
note: body.note !== undefined ? body.note : task.note,
|
||||
recurrence_type: recurrenceType,
|
||||
recurrence_interval:
|
||||
body.recurrence_interval !== undefined
|
||||
|
|
|
|||
|
|
@ -92,13 +92,20 @@ export const updateTask = async (
|
|||
taskUid: string,
|
||||
taskData: Partial<Task>
|
||||
): Promise<Task> => {
|
||||
// Use original_name to prevent display name (e.g. "Monthly", "Daily")
|
||||
// from overwriting the real task name in the database
|
||||
const payload = { ...taskData };
|
||||
if (payload.original_name && payload.name !== undefined) {
|
||||
payload.name = payload.original_name;
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
getApiPath(`task/${encodeURIComponent(taskUid)}`),
|
||||
{
|
||||
method: 'PATCH',
|
||||
credentials: 'include',
|
||||
headers: getPostHeaders(),
|
||||
body: JSON.stringify(taskData),
|
||||
body: JSON.stringify(payload),
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue