Skip to content

Commit

Permalink
fix: gitlab 404 note (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlienard authored Apr 22, 2024
1 parent e8f39b1 commit 4bc5ba0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/features/createGitlabNotificationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export async function prepareGitlabNotificationData(events: GitlabEventWithRepoD
const firstEvent = item.events[0];
const { target_type } = firstEvent;
if (target_type === 'Milestone') return item;
const isNote =
target_type === 'Note' || target_type === 'DiffNote' || target_type === 'DiscussionNote';
const isNote = isNoteType(firstEvent);
let type: 'Issue' | 'MergeRequest' = 'MergeRequest';
if (
(isNote && firstEvent.note.noteable_type === 'Issue') ||
Expand Down Expand Up @@ -118,6 +117,12 @@ export async function prepareGitlabNotificationData(events: GitlabEventWithRepoD
return mergedGroups;
}

function isNoteType(
event: GitlabEventWithRepoData
): event is GitlabEventWithRepoData & { target_type: 'Note' | 'DiffNote' | 'DiscussionNote' } {
return event.target_type?.includes('Note') ?? false;
}

function getTextData(
gitlabEvent: GitlabEventWithRepoData,
hasData = true
Expand Down

0 comments on commit 4bc5ba0

Please sign in to comment.