Skip to content

pr-first-commit-title - Preserve previous user changes - #7237

Merged
fregante merged 3 commits into
mainfrom
use-first-commit-message-for-new-prs
Feb 2, 2024
Merged

fregante merged 3 commits into
mainfrom
use-first-commit-message-for-new-prs

Conversation

@fregante

@fregante fregante commented Feb 2, 2024

Copy link
Copy Markdown
Member

@fregante fregante added the bug label Feb 2, 2024
@fregante fregante changed the title use-first-commit-message-for-new-prs - Preserve previous user changes pr-first-commit-title - Preserve previous user changes Feb 2, 2024
Comment on lines 40 to +43
async function init(): Promise<void | false> {
const sessionResumeId = $('meta[name="session-resume-id"]')?.content;
const previousTitle = sessionResumeId && sessionStorage.getItem(`session-resume:${sessionResumeId}`);
if (previousTitle) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pgimalac the code I had pasted worked, the only change it needed was that the resumeId is the target repo, not the current repo (getRepo())

GitHub sets sessionStorage when the user leaves the page, and removes it on load, that's why it was hard to see.

if (firstCommit.body && !requestedContent.has('pull_request[body]')) {
insertTextIntoField(
$('#new_pull_request textarea[aria-label="Comment body"]')!,
expectElement('#pull_request_body'),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fixes setting the body since the selector was outdated.

@fregante
fregante merged commit 2a484c3 into main Feb 2, 2024
@fregante
fregante deleted the use-first-commit-message-for-new-prs branch February 2, 2024 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

use-first-commit-message-for-new-prs overrides user set title when refreshing page

1 participant