Skip to content

Uncaught ReferenceError: subject is not defined when manually specifying thread ID #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jchampio opened this issue May 29, 2025 · 1 comment

Comments

@jchampio
Copy link
Contributor

0f23363 introduced an automatic Subject when attaching a patch, but the subject variable isn't defined in all code paths. So if you manually specify the thread ID in the popup window, you get

commitfest.js?v=3bcba516-f6c7-474f-9251-99f62bc34d68:75 Uncaught ReferenceError: subject is not defined
    at HTMLAnchorElement.<anonymous> (commitfest.js?v=3bcba516-f6c7-474f-9251-99f62bc34d68:75:31)
    at HTMLAnchorElement.dispatch (jquery.js:3:28337)
    at v.handle (jquery.js:3:25042)

and a hanging dialog spinner.

@nbyavuz
Copy link

nbyavuz commented May 30, 2025

Hi,

I didn't test this manually as I don't have required environment to run project but fix could be:

---
 media/commitfest/js/commitfest.js | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/media/commitfest/js/commitfest.js b/media/commitfest/js/commitfest.js
index 158e572..c92e1db 100644
--- a/media/commitfest/js/commitfest.js
+++ b/media/commitfest/js/commitfest.js
@@ -60,14 +60,15 @@ function browseThreads(attachfunc, closefunc) {
         msgid = $("#attachThreadMessageId").val();
         if (!msgid || msgid === "") {
             msgid = $("#attachThreadList").val();
-            if (!msgid) return;
-            subject = $("#attachThreadList option:selected").data("subject");
-            subject = subject.replace(/\bre: /gi, "");
-            subject = subject.replace(/\bfwd: /gi, "");
-            // Strips [PATCH], [POC], etc. prefixes
-            subject = subject.replace(/\[\w+\]: /gi, "");
-            subject = subject.replace(/\[\w+\] /gi, "");
         }
+        if (!msgid) return;
+
+        subject = $("#attachThreadList option:selected").data("subject");
+        subject = subject.replace(/\bre: /gi, "");
+        subject = subject.replace(/\bfwd: /gi, "");
+        // Strips [PATCH], [POC], etc. prefixes
+        subject = subject.replace(/\[\w+\]: /gi, "");
+        subject = subject.replace(/\[\w+\] /gi, "");
 
         $("#attachThreadListWrap").addClass("loading");
         $("#attachThreadSearchButton").addClass("disabled");
-- 

@JelteF JelteF closed this as completed in d17a0a8 May 31, 2025
JelteF added a commit that referenced this issue May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants