fix: inherit provider from someday list when moving task to weekday slot
Tasks created locally in a synced someday list may not have externalProvider set (if the sync to Google/etc failed). Now when moving such a task to a weekday slot, the provider is inherited from the source list and persisted to the DB. v1.15.7 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
031837cbb2
commit
ecf774e0f9
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "my-weekly-todo-list",
|
"name": "my-weekly-todo-list",
|
||||||
"version": "1.15.6",
|
"version": "1.15.7",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "my-weekly-todo-list",
|
"name": "my-weekly-todo-list",
|
||||||
"version": "1.15.6",
|
"version": "1.15.7",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@auth/prisma-adapter": "^2.11.1",
|
"@auth/prisma-adapter": "^2.11.1",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "my-weekly-todo-list",
|
"name": "my-weekly-todo-list",
|
||||||
"version": "1.15.6",
|
"version": "1.15.7",
|
||||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -359,7 +359,7 @@ export async function PATCH(request: NextRequest) {
|
|||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
|
|
||||||
const { id } = body;
|
const { id } = body;
|
||||||
const { title, description, completed, dayOfWeek, order, markdownContent, scheduledDate, startTime, somedayListId, somedaySlotIndex, isRecurring, recurrenceInterval, recurrenceUnit, recurrenceTime, recurrenceEndDate, recurrenceDays, restore, parentTaskId, projectId } = body;
|
const { title, description, completed, dayOfWeek, order, markdownContent, scheduledDate, startTime, somedayListId, somedaySlotIndex, isRecurring, recurrenceInterval, recurrenceUnit, recurrenceTime, recurrenceEndDate, recurrenceDays, restore, parentTaskId, projectId, externalProvider } = body;
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
@ -448,6 +448,7 @@ export async function PATCH(request: NextRequest) {
|
|||||||
...(somedaySlotIndex !== undefined && { somedaySlotIndex: somedaySlotIndex !== null ? parseInt(somedaySlotIndex) : null }),
|
...(somedaySlotIndex !== undefined && { somedaySlotIndex: somedaySlotIndex !== null ? parseInt(somedaySlotIndex) : null }),
|
||||||
...(parentTaskId !== undefined && { parentTaskId: parentTaskId || null }),
|
...(parentTaskId !== undefined && { parentTaskId: parentTaskId || null }),
|
||||||
...(projectId !== undefined && { projectId: projectId || null }),
|
...(projectId !== undefined && { projectId: projectId || null }),
|
||||||
|
...(externalProvider !== undefined && { externalProvider: externalProvider || null }),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -3448,6 +3448,9 @@ export default function WeeklyView() {
|
|||||||
// If the task was from a someday list, move it to the calendar
|
// If the task was from a someday list, move it to the calendar
|
||||||
if (draggedTask.somedayListId) {
|
if (draggedTask.somedayListId) {
|
||||||
const newScheduledDate = formatDateToISO(targetDateObj);
|
const newScheduledDate = formatDateToISO(targetDateObj);
|
||||||
|
// Inherit provider from someday list if task doesn't have one
|
||||||
|
const sourceList = somedayLists.find(l => l.id === draggedTask.somedayListId);
|
||||||
|
const taskProvider = draggedTask.externalProvider || sourceList?.externalProvider || null;
|
||||||
// Remove from someday list UI
|
// Remove from someday list UI
|
||||||
setSomedayLists((prev) =>
|
setSomedayLists((prev) =>
|
||||||
prev.map((l) => ({
|
prev.map((l) => ({
|
||||||
@ -3465,6 +3468,7 @@ export default function WeeklyView() {
|
|||||||
scheduledDate: newScheduledDate,
|
scheduledDate: newScheduledDate,
|
||||||
dayOfWeek,
|
dayOfWeek,
|
||||||
startTime: targetSlot || "",
|
startTime: targetSlot || "",
|
||||||
|
externalProvider: taskProvider,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
// Persist
|
// Persist
|
||||||
@ -3479,6 +3483,7 @@ export default function WeeklyView() {
|
|||||||
scheduledDate: newScheduledDate,
|
scheduledDate: newScheduledDate,
|
||||||
dayOfWeek,
|
dayOfWeek,
|
||||||
startTime: targetSlot || "",
|
startTime: targetSlot || "",
|
||||||
|
...(taskProvider && !draggedTask.externalProvider && { externalProvider: taskProvider }),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user