mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
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:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user