fix: clear all cached series rows on recurring delete + render star for any important task
- deleteCachedEvent now removes every cached row that belongs to the same recurring series (master id + all "<masterId>::*" instances + rows whose recurringEventId matches the master), so deleting "all occurrences" no longer leaves orphan rows that resurface on the next read. - getPriorityBadge: surface the yellow star whenever a task is marked important (e.g. a starred Outlook To-Do task pulled in via sync), even when the active priority style is Eisenhower / ABCDE / Ivy Lee. v1.103.1 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
42905641cd
commit
bf2819ce67
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.103.0",
|
||||
"version": "1.103.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.103.0",
|
||||
"version": "1.103.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@auth/prisma-adapter": "^2.11.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.103.0",
|
||||
"version": "1.103.1",
|
||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@ -9836,13 +9836,26 @@ function makeBadgeCircle(text: string, color: string, size: number, label: strin
|
||||
}
|
||||
|
||||
export function getPriorityBadge(task: Task, style: string, size = 12): PriorityBadge | null {
|
||||
// Universal "important" star — shown for any task explicitly marked important
|
||||
// (e.g. Outlook To-Do tasks with the star flag) regardless of the active priority style.
|
||||
const importantStar = (): PriorityBadge => ({
|
||||
label: "Important",
|
||||
node: <Star size={size + 1} fill="#eab308" color="#eab308" style={{ flexShrink: 0 }} />,
|
||||
});
|
||||
|
||||
if (style === "abcde") {
|
||||
if (!task.priority || !PRIORITY_LETTER_COLORS[task.priority]) return null;
|
||||
return makeBadgeCircle(task.priority, PRIORITY_LETTER_COLORS[task.priority], size + 2, task.priority);
|
||||
if (task.priority && PRIORITY_LETTER_COLORS[task.priority]) {
|
||||
return makeBadgeCircle(task.priority, PRIORITY_LETTER_COLORS[task.priority], size + 2, task.priority);
|
||||
}
|
||||
if (task.importance === true) return importantStar();
|
||||
return null;
|
||||
}
|
||||
if (style === "ivylee") {
|
||||
if (!task.priority || !PRIORITY_NUMBER_COLORS[task.priority]) return null;
|
||||
return makeBadgeCircle(task.priority, PRIORITY_NUMBER_COLORS[task.priority], size + 2, `Ivy Lee #${task.priority}`);
|
||||
if (task.priority && PRIORITY_NUMBER_COLORS[task.priority]) {
|
||||
return makeBadgeCircle(task.priority, PRIORITY_NUMBER_COLORS[task.priority], size + 2, `Ivy Lee #${task.priority}`);
|
||||
}
|
||||
if (task.importance === true) return importantStar();
|
||||
return null;
|
||||
}
|
||||
if (style === "pareto") {
|
||||
if (task.importance !== true && task.priority !== "A" && task.priority !== "B") return null;
|
||||
@ -9861,6 +9874,8 @@ export function getPriorityBadge(task: Task, style: string, size = 12): Priority
|
||||
return { label: "Delegieren", node: <CornerUpRight size={size} color="#f97316" style={{ flexShrink: 0 }} /> };
|
||||
return { label: "Eliminieren", node: <Archive size={size} color="#9ca3af" style={{ flexShrink: 0 }} /> };
|
||||
}
|
||||
// Eisenhower with only importance set (e.g. imported from Outlook with no urgency)
|
||||
if (task.importance === true) return importantStar();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -218,7 +218,22 @@ export async function deleteCachedEvent(
|
||||
externalId: string,
|
||||
provider: string,
|
||||
): Promise<void> {
|
||||
// For Outlook recurring events, our composite ID is "seriesMasterId::instanceId".
|
||||
// When the user deletes the whole series, every cached occurrence of that series
|
||||
// must be cleared too — otherwise the surviving rows reappear after the next read.
|
||||
const seriesMasterId = externalId.includes('::') ? externalId.split('::')[0] : externalId;
|
||||
|
||||
await prisma.cachedCalendarEvent.deleteMany({
|
||||
where: { userId, externalId, provider },
|
||||
where: {
|
||||
userId,
|
||||
provider,
|
||||
OR: [
|
||||
{ externalId },
|
||||
{ externalId: seriesMasterId },
|
||||
{ recurringEventId: seriesMasterId },
|
||||
// The composite IDs of all instances start with "<seriesMasterId>::"
|
||||
{ externalId: { startsWith: `${seriesMasterId}::` } },
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user