fix(journey): a failed notification never fails the write it reports

The contributor invite and the comment notification read the actor's
name before the fire-and-forget send, so a failing lookup turned an
already saved contributor or comment into an error answer.
This commit is contained in:
Maurice
2026-11-30 15:20:06 +01:00
parent cbdc6850ca
commit c84ec093d7
2 changed files with 3 additions and 3 deletions
@@ -72,7 +72,7 @@ export class JourneyCommentsService {
body,
});
await this.announce(journeyId, entryId, id, 'added', sid);
await this.notifyOwner(journey.user_id, journey.title, entry, { kind: 'user', userId });
await this.notifyOwner(journey.user_id, journey.title, entry, { kind: 'user', userId }).catch(() => {});
const row = await this.commentsRepo.findWithAuthor(id);
if (!row) throw new DomainError(404, 'Comment not found');
return toJourneyComment(row, userId);
@@ -139,7 +139,7 @@ export class JourneyCommentsService {
});
await this.announce(link.journey_id, entryId, id, 'added');
const journey = await this.journeysRepo.findById(link.journey_id);
if (journey) await this.notifyOwner(journey.user_id, journey.title, entry, { kind: 'guest', name });
if (journey) await this.notifyOwner(journey.user_id, journey.title, entry, { kind: 'guest', name }).catch(() => {});
}
private async requireAccess(journeyId: number, userId: number) {
+1 -1
View File
@@ -149,7 +149,7 @@ export class JourneyService {
async addContributor(id: number, userId: number, targetUserId: number, role: 'editor' | 'viewer') {
const alreadyIn = (await this.journey.canAccessJourney(id, targetUserId)) !== null;
const added = await this.journey.addContributor(id, userId, targetUserId, role);
if (added && !alreadyIn) await this.notifyInvite(id, userId, targetUserId, role);
if (added && !alreadyIn) await this.notifyInvite(id, userId, targetUserId, role).catch(() => {});
return added;
}