Skip to content

Commit b947d8d

Browse files
committed
local environment considerations
Signed-off-by: Vedansh Saini <[email protected]>
1 parent 91d2a7a commit b947d8d

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"*://outlook.office.com/*",
2525
"*://mail.yahoo.com/*"
2626
],
27-
"js": ["scripts/jquery-3.2.1.min.js", "scripts/scrumHelper.js", "scripts/emailClientAdapter.js"]
27+
"js": ["scripts/jquery-3.2.1.min.js", "scripts/emailClientAdapter.js", "scripts/scrumHelper.js"]
2828
}
2929
],
3030

src/scripts/emailClientAdapter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
class EmailClientAdapter {
23
isNewConversation() {
34
const clientType = this.detectClient();
@@ -212,3 +213,4 @@ class EmailClientAdapter {
212213

213214
// Create global instance
214215
window.emailClientAdapter = new EmailClientAdapter();
216+
console.log('Email client adapter initialized');

src/scripts/scrumHelper.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
console.log('Script loaded, adapter exists:', !!window.emailClientAdapter);
12
var enableToggle = true;
23
function allIncluded(outputTarget = 'email') {
34
console.log('allIncluded called with outputTarget:', outputTarget);
@@ -303,16 +304,13 @@ ${userReason}`;
303304
return project;
304305
}
305306
function scrumSubjectLoaded() {
307+
try{
308+
309+
306310
if (!enableToggle) return;
307-
if(outputTarget === 'email') {
308-
if(!window.emailClientAdapter) {
309-
console.error('Email client adapter not found');
310-
return;
311-
}
312-
if(!window.emailClientAdapter.isNewConversation()) {
313-
console.log('Not a new conversation, skipping subject modification');
314-
return;
315-
}
311+
if (!scrumSubject){
312+
console.error('Subject element not found');
313+
return;
316314
}
317315
setTimeout(() => {
318316
var name = githubUserData.name || githubUsername;
@@ -328,6 +326,9 @@ ${userReason}`;
328326
scrumSubject.value = '[Scrum] ' + name + ' - ' + project + ' - ' + dateCode + ' - False';
329327
scrumSubject.dispatchEvent(new Event('input', { bubbles: true }));
330328
});
329+
} catch (err) {
330+
console.err('Error while setting subject: ', err);
331+
}
331332
}
332333

333334
function writeGithubPrsReviews() {
@@ -478,7 +479,10 @@ ${userReason}`;
478479

479480
clearInterval(intervalSubject);
480481
scrumSubject = elements.subject;
481-
scrumSubjectLoaded();
482+
483+
setTimeout(() => {
484+
scrumSubjectLoaded();
485+
}, 500);
482486
}, 500);
483487

484488
//check for github safe writing for both issues/prs and pr reviews

0 commit comments

Comments
 (0)