@@ -4,6 +4,7 @@ console.log("Script loaded", new Date().toISOString());
4
4
let refreshButton_Placed = false ;
5
5
//# sourceURL=scrumHelper.js
6
6
let enableToggle = true ;
7
+ let hasInjectedContent = false ;
7
8
function allIncluded ( ) {
8
9
/* global $*/
9
10
let scrumBody = null ;
@@ -142,7 +143,7 @@ function allIncluded() {
142
143
return WeekDisplayPadded ;
143
144
}
144
145
145
- const DEBUG = false ;
146
+ const DEBUG = true ;
146
147
function log ( ...args ) {
147
148
if ( DEBUG ) {
148
149
console . log ( `[SCRUM-HELPER]:` , ...args ) ;
@@ -347,6 +348,7 @@ function allIncluded() {
347
348
348
349
async function forceGithubDataRefresh ( ) {
349
350
log ( 'Force refreshing GitHub data' ) ;
351
+ hasInjectedContent = false ; // Reset injection flag
350
352
// clear cache
351
353
githubCache = {
352
354
data : null ,
@@ -402,7 +404,7 @@ function allIncluded() {
402
404
403
405
//load initial text in scrum body
404
406
function writeScrumBody ( ) {
405
- if ( ! enableToggle ) return ;
407
+ if ( ! enableToggle || hasInjectedContent ) return ;
406
408
407
409
setTimeout ( ( ) => {
408
410
// Generate content first
@@ -445,12 +447,13 @@ function allIncluded() {
445
447
}
446
448
447
449
window . emailClientAdapter . injectContent ( elements . body , content , elements . eventTypes . contentChange ) ;
450
+ hasInjectedContent = true ; // Mark as injected
448
451
} ) ;
449
452
}
450
453
451
454
//load initial scrum subject
452
455
function scrumSubjectLoaded ( ) {
453
- if ( ! enableToggle ) return ;
456
+ if ( ! enableToggle || hasInjectedContent ) return ;
454
457
setTimeout ( ( ) => {
455
458
let name = githubUserData . name || githubUsername ;
456
459
let project = projectName || '<project name>' ;
@@ -696,15 +699,9 @@ function allIncluded() {
696
699
697
700
//check for github safe writing
698
701
let intervalWriteGithub = setInterval ( ( ) => {
699
- if ( scrumBody && githubUsername && githubIssuesData ) {
702
+ if ( scrumBody && githubUsername && githubIssuesData && githubPrsReviewData ) {
700
703
clearInterval ( intervalWriteGithub ) ;
701
704
writeGithubIssuesPrs ( ) ;
702
- }
703
- } , 500 ) ;
704
- //check for github prs reviews safe writing
705
- let intervalWriteGithubReviews = setInterval ( ( ) => {
706
- if ( scrumBody && githubUsername && githubPrsReviewData ) {
707
- clearInterval ( intervalWriteGithubReviews ) ;
708
705
writeGithubPrsReviews ( ) ;
709
706
}
710
707
} , 500 ) ;
@@ -728,6 +725,7 @@ function allIncluded() {
728
725
} , 1000 ) ;
729
726
}
730
727
function handleRefresh ( ) {
728
+ hasInjectedContent = false ; // Reset the flag before refresh
731
729
allIncluded ( ) ;
732
730
}
733
731
}
0 commit comments