@@ -14,7 +14,9 @@ let refreshButton_Placed = false;
14
14
let enableToggle = true ;
15
15
let hasInjectedContent = false ;
16
16
let scrumGenerationInProgress = false ;
17
- let orgName = 'fossasia' ; // default
17
+
18
+ let orgName = '' ;
19
+
18
20
function allIncluded ( outputTarget = 'email' ) {
19
21
if ( scrumGenerationInProgress ) {
20
22
console . warn ( '[SCRUM-HELPER]: Scrum generation already in progress, aborting new call.' ) ;
@@ -175,8 +177,9 @@ function allIncluded(outputTarget = 'email') {
175
177
log ( 'Restored cache from storage' ) ;
176
178
}
177
179
178
- if ( items . orgName ) {
179
- orgName = items . orgName ;
180
+ if ( typeof items . orgName !== 'undefined' ) {
181
+ orgName = items . orgName || '' ;
182
+ console . log ( '[SCRUM-HELPER] orgName set to:' , orgName ) ;
180
183
}
181
184
} ,
182
185
) ;
@@ -324,7 +327,7 @@ function allIncluded(outputTarget = 'email') {
324
327
}
325
328
326
329
async function fetchGithubData ( ) {
327
- const cacheKey = `${ githubUsername } -${ orgName } -${ startingDate } -${ endingDate } ` ;
330
+ const cacheKey = `${ githubUsername } -${ startingDate } -${ endingDate } -${ orgName || 'all' } ` ;
328
331
329
332
if ( githubCache . fetching || ( githubCache . cacheKey === cacheKey && githubCache . data ) ) {
330
333
log ( 'Fetch already in progress or data already fetched. Skipping fetch.' ) ;
@@ -396,8 +399,17 @@ function allIncluded(outputTarget = 'email') {
396
399
log ( 'Making public requests' ) ;
397
400
}
398
401
399
- let issueUrl = `https://api.github.com/search/issues?q=author%3A${ githubUsername } +org%3A${ orgName } +updated%3A${ startingDate } ..${ endingDate } &per_page=100` ;
400
- let prUrl = `https://api.github.com/search/issues?q=commenter%3A${ githubUsername } +org%3A${ orgName } +updated%3A${ startingDate } ..${ endingDate } &per_page=100` ;
402
+ // Build org part for query only if orgName is set and not empty
403
+ console . log ( '[SCRUM-HELPER] orgName before API query:' , orgName ) ;
404
+ console . log ( '[SCRUM-HELPER] orgName type:' , typeof orgName ) ;
405
+ console . log ( '[SCRUM-HELPER] orgName length:' , orgName ? orgName . length : 0 ) ;
406
+ let orgPart = orgName && orgName . trim ( ) ? `+org%3A${ orgName } ` : '' ;
407
+ console . log ( '[SCRUM-HELPER] orgPart for API:' , orgPart ) ;
408
+ console . log ( '[SCRUM-HELPER] orgPart length:' , orgPart . length ) ;
409
+ let issueUrl = `https://api.github.com/search/issues?q=author%3A${ githubUsername } ${ orgPart } +updated%3A${ startingDate } ..${ endingDate } &per_page=100` ;
410
+ let prUrl = `https://api.github.com/search/issues?q=commenter%3A${ githubUsername } ${ orgPart } +updated%3A${ startingDate } ..${ endingDate } &per_page=100` ;
411
+ console . log ( '[SCRUM-HELPER] issueUrl:' , issueUrl ) ;
412
+ console . log ( '[SCRUM-HELPER] prUrl:' , prUrl ) ;
401
413
let userUrl = `https://api.github.com/users/${ githubUsername } ` ;
402
414
403
415
try {
@@ -676,6 +688,7 @@ ${lastWeekUl}<br>
676
688
${ nextWeekUl } <br>
677
689
<b>3. What is blocking me from making progress?</b><br>
678
690
${ userReason } `;
691
+
679
692
}
680
693
681
694
@@ -1145,6 +1158,7 @@ async function forceGithubDataRefresh() {
1145
1158
1146
1159
// allIncluded('email');
1147
1160
1161
+
1148
1162
if ( window . location . protocol . startsWith ( 'http' ) ) {
1149
1163
allIncluded ( 'email' ) ;
1150
1164
$ ( 'button>span:contains(New conversation)' ) . parent ( 'button' ) . click ( ( ) => {
@@ -1177,6 +1191,7 @@ ${prs.map((pr, i) => ` repo${i}: repository(owner: \"${pr.owner}\", name: \"${pr
1177
1191
pr${ i } : pullRequest(number: ${ pr . number } ) { merged }
1178
1192
}` ) . join ( '\n' ) }
1179
1193
}` ;
1194
+
1180
1195
try {
1181
1196
const res = await fetch ( 'https://api.github.com/graphql' , {
1182
1197
method : 'POST' ,
@@ -1196,4 +1211,5 @@ ${prs.map((pr, i) => ` repo${i}: repository(owner: \"${pr.owner}\", name: \"${pr
1196
1211
} catch ( e ) {
1197
1212
return results ;
1198
1213
}
1199
- }
1214
+ }
1215
+
0 commit comments