Skip to content
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

close-as-unplanned doesn't reset to correct text after sending a comment #7406

Closed
kidonng opened this issue Jun 5, 2024 · 2 comments
Closed

Comments

@kidonng
Copy link
Member

kidonng commented Jun 5, 2024

Description

The button should reset to "Close issue" instead of staying "Close with comment":

Screen.Recording.2024-06-05.at.19.17.45.mov

How to replicate the issue + URL

Test on refined-github/sandbox#73

Extension version

24.6.2

Browser(s) used

Chrome

@kidonng
Copy link
Member Author

kidonng commented Jun 5, 2024

Yeah I'm confused, this is actually a GitHub bug. I thought it would be trivial to fix but this doesn't work for reasons beyond me:

diff --git a/source/features/close-as-unplanned.tsx b/source/features/close-as-unplanned.tsx
--- a/source/features/close-as-unplanned.tsx	(revision 97f6ef6436253dc8fc4a7282c5e3a9cd4a424142)
+++ b/source/features/close-as-unplanned.tsx	(date 1717610560238)
@@ -39,9 +39,15 @@
 	$(unplannedCheckbox, button.form!)!.checked = button.id === id;
 }
 
+function restoreCloseButtonText(): void {
+	const spanText = $('.js-comment-and-button .js-form-action-text')!;
+	spanText.textContent = spanText.getAttribute('data-default-action-text')!;
+}
+
 function init(signal: AbortSignal): void {
 	observe('close-reason-selector .select-menu', update, {signal});
 	delegate('[name="comment_and_close"]', 'click', updateCheckbox, {signal});
+	delegate('.js-new-comment-form', 'comment:success', restoreCloseButtonText, {signal});
 }
 
 void features.add(import.meta.url, {

I will leave this open but feel free to close if it's not worth investigating further.

@kidonng kidonng added github bug and removed bug labels Jun 5, 2024
@fregante fregante closed this as completed Jun 5, 2024
@fregante fregante reopened this Jun 5, 2024
@fregante
Copy link
Member

fregante commented Jun 5, 2024

Yeah let's not. It's a GitHub bug unrelated to that feature. Since it's just cosmetic, it's not worth adding at this point.

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants