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

restore-file UX improvements #6621

Merged
merged 4 commits into from
May 6, 2023
Merged

restore-file UX improvements #6621

merged 4 commits into from
May 6, 2023

Conversation

fregante
Copy link
Member

@fregante fregante commented May 6, 2023

Changes

  • Allow deletion via API
  • "Drop" was a bit awkward, I replaced with with "Remove from PR", then again with "Discard changes"

Test URLs

https://github.com/refined-github/sandbox/pull/16/files

Screenshot

2

Prior art

GitHub Desktop

Screenshot 9

VS Code

Screenshot 10

cc @134130

if (!file) {
// The file was created by this PR.
// This code won’t be reached if `highlight-deleted-and-added-files-in-diffs` works.
throw new Error('Nothing to drop. Delete file instead');
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now possible. We had only dropped this part because we used to load the native "delete" page and act on that. Now it's much easier via API

2

// This code won’t be reached if `highlight-deleted-and-added-files-in-diffs` works.
throw new Error('Nothing to drop. Delete file instead');
if (file?.isTruncated) {
throw new Error('File too big, you’ll have to use git');
Copy link
Member Author

Choose a reason for hiding this comment

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

Improved error message, including solution


const {nameWithOwner, branch: prBranch} = getBranches().head;
progress(menuItem.closest('[data-file-deleted="true"]') ? 'Undeleting…' : 'Committing…');
progress('Committing…');
Copy link
Member Author

Choose a reason for hiding this comment

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

It's not necessary to differentiate the status here. In every case we're "Committing…"

@fregante fregante changed the title restore-file improvements restore-file UX improvements May 6, 2023
@fregante fregante enabled auto-merge (squash) May 6, 2023 14:43
@fregante fregante merged commit 0368fbf into main May 6, 2023
11 checks passed
@fregante fregante deleted the restore-file branch May 6, 2023 14:43
@yakov116
Copy link
Member

yakov116 commented May 7, 2023

Much better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants