Skip to content

Commit 45df419

Browse files
committed
fix: switch getIssues gql to issueEvents
1 parent f384297 commit 45df419

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

nerdlets/shared/utils.js

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -778,40 +778,43 @@ export const getNotifications = async (account, sinceClause) => {
778778
// }
779779

780780
export const getIssues = async (account, cursor, timeWindow) => {
781-
//TODO: product to fix api behavior
782781
let gql = ``;
782+
783783
if (cursor == null) {
784+
//TODO: this graphql can still be improved by engineering (i.e: filter for eventType)
784785
gql = `
785-
{
786-
actor {
787-
account(id: ${account.accountId}) {
788-
aiIssues {
789-
issues(
790-
timeWindow: {endTime: ${timeWindow.end}, startTime: ${timeWindow.start}}
791-
) {
792-
issues {
793-
conditionName
794-
issueId
795-
policyName
796-
title
797-
activatedAt
798-
closedAt
799-
eventType
786+
{
787+
actor {
788+
account(id: ${account.accountId}) {
789+
aiIssues {
790+
issuesEvents(
791+
filter: {states: ACTIVATED}
792+
timeWindow: {endTime: ${timeWindow.end}, startTime: ${timeWindow.start}}
793+
) {
794+
issues {
795+
conditionName
796+
issueId
797+
policyName
798+
title
799+
activatedAt
800+
closedAt
801+
eventType
802+
}
803+
nextCursor
800804
}
801-
nextCursor
802805
}
803806
}
804807
}
805-
}
806-
}`;
808+
}`;
807809
} else {
808810
gql = `
809-
{
811+
{
810812
actor {
811813
account(id: ${account.accountId}) {
812814
aiIssues {
813-
issues(
815+
issuesEvents(
814816
cursor: "${cursor}"
817+
filter: {states: ACTIVATED}
815818
timeWindow: {endTime: ${timeWindow.end}, startTime: ${timeWindow.start}}
816819
) {
817820
issues {
@@ -828,8 +831,7 @@ export const getIssues = async (account, cursor, timeWindow) => {
828831
}
829832
}
830833
}
831-
}
832-
`;
834+
}`;
833835
}
834836

835837
const data = await NerdGraphQuery.query({
@@ -841,8 +843,9 @@ export const getIssues = async (account, cursor, timeWindow) => {
841843
console.debug(data.error);
842844
return null;
843845
}
844-
let result = data?.data?.actor?.account?.aiIssues?.issues?.issues;
845-
let nextCursor = data?.data?.actor?.account?.aiIssues?.issues?.nextCursor;
846+
let result = data?.data?.actor?.account?.aiIssues?.issuesEvents?.issues;
847+
let nextCursor =
848+
data?.data?.actor?.account?.aiIssues?.issuesEvents?.nextCursor;
846849

847850
if (nextCursor == null) {
848851
return result;

0 commit comments

Comments
 (0)