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

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

Merged
merged 3 commits into from Feb 2, 2024

Conversation

fregante
Copy link
Member

@fregante fregante commented Feb 2, 2024

@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
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.

firstCommit.title,
);
}

if (firstCommit.body && !requestedContent.has('pull_request[body]')) {
insertTextIntoField(
$('#new_pull_request textarea[aria-label="Comment body"]')!,
expectElement('#pull_request_body'),
Copy link
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
11 checks passed
@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