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

Batch delete issue and improve tippy opts #25253

Merged
merged 11 commits into from
Jun 19, 2023

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Jun 14, 2023

  1. Add "batch delete" button for selected issues, close Delete multiple issues at once #22273
  2. Address the review in Change form actions to fetch for submit review box #25219 (comment)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 14, 2023
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 14, 2023
delete opts.onDestroy;
delete opts.onShow;

const {onHide, onShow, onDestroy, ...other} = opts;
Copy link
Member

Choose a reason for hiding this comment

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

Would also destructure role and content here.

Copy link
Member

Choose a reason for hiding this comment

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

Can even shorten it by placing the destructure in the function definition:

export function createTippy(target, {onHide, onShow, onDestroy, role, content, ...other} = {})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would also destructure role and content here.

IMO the code would be more complex for using "role" later. Could you try to improve it by your idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

export function createTippy(target, {onHide, onShow, onDestroy, role, content, ...other} = {})

Well, personally I dislike such syntax. But if you prefer, no block from my side.

Copy link
Member

Choose a reason for hiding this comment

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

Definitely prefer that, it's most readable to me. Don't have time right now, but I can do a few modifications later.

@@ -1412,6 +1412,7 @@ issues.filter_sort.fewestforks = Fewest forks
issues.keyword_search_unavailable = Currently searching by keyword is not available. Please contact your site administrator.
issues.action_open = Open
issues.action_close = Close
issues.action_delete_confirm = Confirm to delete all issues?
Copy link
Member

@silverwind silverwind Jun 14, 2023

Choose a reason for hiding this comment

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

Would prefer something more generic:

delete_all_confirm = Delete all items?

And likely move it to top-level translation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 8960441

But I still do not think it is a generic string.

And the "generic" problem is: without careful maintenance, it will become more and more messy. For example, why rerun_all = Re-run all jobsappears in the global scope? It isn't generic indeed.

Copy link
Member

Choose a reason for hiding this comment

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

If a translation could reasonably appear in more than 1 scope, it should be global, but I guess the one you posted is likely to be single-use.

Overall, I think we should just get rid of scopes altogether in the translation, removing all duplicates in the process. Those scope have no benefit except encourage duplication.

@silverwind silverwind changed the title Batch delete issue and improvie tippy opts Batch delete issue and improve tippy opts Jun 15, 2023
delete opts.onDestroy;
delete opts.onShow;

export function createTippy(target, {onHide, onShow, onDestroy, role, content, ...other} = {}) {
Copy link
Contributor Author

@wxiaoguang wxiaoguang Jun 15, 2023

Choose a reason for hiding this comment

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

Well, this is wrong now (that's what I said why it is really unclear).

Because the role is exacted, other doesn't contain role. Then how do you use ...other to override the default role ....


I reverted the code, the old code looks good to me.

Copy link
Member

Choose a reason for hiding this comment

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

The only change that was needed would have been role: role || 'menu'. I still want to do my method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think current style is the best, the reasons are:

  1. export function createTippy(target, opts = {}) is shorter and clearer for readers, it's easy to catch the function declaration.
  2. I remember that you mentioned that you don't want to read a line with more than 100 chars, using destructing in the function declaration makes the line longer and longer.
  3. If you destructure "role", this time you can patch the code by role: role || 'menu', next time if another variable is destructed, developers would forget the ...other overriding again. It is quite fragile and unclear. For example, I have mentioned that the code would be more complex for using "role" later., the changed code still contains bugs, so it is a complex and counterintuitive problem.

Copy link
Member

Choose a reason for hiding this comment

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

Well I guess we can keep it.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 16, 2023
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jun 19, 2023
@lunny lunny added this to the 1.21.0 milestone Jun 19, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 19, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 19, 2023
@lunny lunny enabled auto-merge (squash) June 19, 2023 04:52
@lunny lunny merged commit a1c5057 into go-gitea:main Jun 19, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 19, 2023
@wxiaoguang wxiaoguang deleted the batch-delete-issue branch June 19, 2023 07:47
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 19, 2023
* giteaofficial/main:
  Fix incorrect actions ref_name (go-gitea#25358)
  Make backend code respond correct JSON when creating PR (go-gitea#25353)
  Fix loading state regression in markup content (go-gitea#25349)
  Batch delete issue and improve tippy opts (go-gitea#25253)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete multiple issues at once
5 participants