Skip to content

Commit 5a02317

Browse files
committed
🐛 fix(recurring-events): allow someday instance to standalone transition
1 parent cf47e24 commit 5a02317

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/backend/src/event/classes/compass.event.generator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
parseCompassEventDate,
2222
} from "@core/util/event/event.util";
2323
import mongoService from "@backend/common/services/mongo.service";
24+
import { GenericError } from "../../common/errors/generic/generic.errors";
25+
import { error } from "../../common/errors/handlers/error.handler";
2426

2527
export class CompassEventFactory {
2628
private static async findCompassEvent(
@@ -220,7 +222,8 @@ export class CompassEventFactory {
220222
);
221223

222224
if (dbEvent && isBase(dbEvent)) {
223-
throw new Error(
225+
throw error(
226+
GenericError.BadRequest,
224227
`You cannot edit a base event with this option(${RecurringEventUpdateScope.THIS_EVENT})`,
225228
);
226229
}

packages/backend/src/sync/services/sync/compass.sync.processor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export class CompassSyncProcessor {
129129
case "NIL->>RECURRENCE_BASE_CONFIRMED":
130130
case "STANDALONE_SOMEDAY->>STANDALONE_CONFIRMED":
131131
case "RECURRENCE_BASE_SOMEDAY->>RECURRENCE_BASE_CONFIRMED":
132+
case "RECURRENCE_INSTANCE_SOMEDAY->>STANDALONE_CONFIRMED":
132133
return parser.createEvent(session);
133134
case "STANDALONE_SOMEDAY->>STANDALONE_SOMEDAY_CONFIRMED":
134135
case "STANDALONE->>STANDALONE_CONFIRMED":

packages/web/src/ducks/events/sagas/someday.sagas.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export function* convertSomedayToCalendarEvent({
3333
try {
3434
const gridEvent = yield* _assembleGridEvent(payload.event);
3535

36+
delete gridEvent.recurrence;
37+
3638
optimisticEvent = yield* _createOptimisticGridEvent(gridEvent);
3739

3840
yield* _editEvent(gridEvent);
@@ -45,7 +47,7 @@ export function* convertSomedayToCalendarEvent({
4547
);
4648
}
4749

48-
yield put(getSomedayEventsSlice.actions.insert(payload.event._id));
50+
yield put(getSomedayEventsSlice.actions.insert(payload.event._id!));
4951
yield put(editEventSlice.actions.error());
5052

5153
handleError(error as Error);

0 commit comments

Comments
 (0)