clear-pr-merge-commit-message - Only clear squash merge commit messages#9398
clear-pr-merge-commit-message - Only clear squash merge commit messages#9398
clear-pr-merge-commit-message - Only clear squash merge commit messages#9398Conversation
Agent-Logs-Url: https://github.com/refined-github/refined-github/sessions/9fc6716f-e190-491e-acc8-6b4c5aba3364 Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Agent-Logs-Url: https://github.com/refined-github/refined-github/sessions/9fc6716f-e190-491e-acc8-6b4c5aba3364 Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
Agent-Logs-Url: https://github.com/refined-github/refined-github/sessions/9fc6716f-e190-491e-acc8-6b4c5aba3364 Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
clear-pr-merge-commit-message - Only clear squash merge commit messages
| await expectToken(); | ||
| observe('textarea[placeholder="Add an optional extended description…"]', clear, {signal}); | ||
| observe(mergeMessageFieldSelector, clearIfSquashing, {signal}); | ||
| observe(confirmMergeButton, async () => { |
There was a problem hiding this comment.
You don't need to change anything in the init. Just make changes in "clear"
There was a problem hiding this comment.
Updated in 20568f0. init is back to the single textarea observer and the squash-only check now happens inside clear. Screenshot: https://github.com/user-attachments/assets/b801fbb4-c4ee-4801-a41a-dfb0f78a09a3
| } | ||
|
|
||
| async function clearIfSquashing(messageField: HTMLTextAreaElement): Promise<void> { | ||
| const mergeButton = $optional(confirmMergeButton); |
There was a problem hiding this comment.
Never optional, the button must exist.
There was a problem hiding this comment.
Updated in 20568f0. I removed the optional lookup and now use $(confirmMergeButton).textContent directly. Screenshot: https://github.com/user-attachments/assets/b801fbb4-c4ee-4801-a41a-dfb0f78a09a3
|
|
||
| async function clearIfSquashing(messageField: HTMLTextAreaElement): Promise<void> { | ||
| const mergeButton = $optional(confirmMergeButton); | ||
| if (!mergeButton || !isSquashMergeButtonText(mergeButton.textContent ?? '')) { |
There was a problem hiding this comment.
Don't use a helper. Just inline /squash/i.test($(blah blah selector).textContent)
Don't use || '', not needed in this repo
There was a problem hiding this comment.
Updated in 20568f0. The helper is gone and the check is now inlined as /squash/i.test($(confirmMergeButton).textContent). Screenshot: https://github.com/user-attachments/assets/b801fbb4-c4ee-4801-a41a-dfb0f78a09a3
Agent-Logs-Url: https://github.com/refined-github/refined-github/sessions/a8054dba-3b73-4592-9c0a-812da1cad5a6 Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
|
refined-github/source/features/sync-pr-commit-title.tsx Lines 42 to 52 in b323b3d |
Restores
clear-pr-merge-commit-messageto its documented scope: only squash merges should have their extended description cleared. Non-squash merge/rebase flows now keep GitHub’s default message body, which preserves the PR title in merge commit history.The implementation now keeps the existing feature flow and performs the squash-only check directly inside
clear()by matching the current merge button text.Test URLs
Screenshot