Skip to content

Add extend-discussion-status-filters feature - #2745

Merged
fregante merged 48 commits into
refined-github:masterfrom
KarlHeitmann:2574_remove_is_open_is_closed_pr
Feb 7, 2020
Merged

fregante merged 48 commits into
refined-github:masterfrom
KarlHeitmann:2574_remove_is_open_is_closed_pr

Conversation

@KarlHeitmann

@KarlHeitmann KarlHeitmann commented Jan 31, 2020 •

Copy link
Copy Markdown
Contributor

Closes #2574 feature request.

Test

You can test it on any issues page. For example: here


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@KarlHeitmann

Copy link
Copy Markdown
Contributor Author

I've passed the linter to fix the previous errors, however there are some errors that right now I couldn't figure out how to solve. Can someone give me a hint, or if I need to find another approach to solve these errors.

@yakov116

yakov116 commented Jan 31, 2020 •

Copy link
Copy Markdown
Member

Did you try xo --fix?

KarlHeitmann and others added 3 commits January 31, 2020 21:16
arrow function and variable renamed to a more meaningful name

Co-Authored-By: Sindre Sorhus <[email protected]>
…. In addition, more unused comments have been removed
@KarlHeitmann

Copy link
Copy Markdown
Contributor Author

Did you try xo --fix?

@yakov116 , there are some comments where I've run npm run lint-fix, however, the lint errors that remains, the auto fixer is unable to fix. I believe it is because there must be added some type of variable on TS that I don't know which should be. I've tried again with npx xo --fix, but this command was also unable to auto fix the problems.

linkMergedSearchParameters.set('q', linkMergedSearchString.replace(regexpQuery, 'is:merged').trim());
}

linkIsMerged.search = String(linkMergedSearchParameters);

@fregante fregante Feb 1, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To generate this link, try:

  • cloning the “closed” link with cloneNode(true) instead of generating a new <a>
  • setting the textContent to "Merged"`
  • running this on its query: .replace('is:closed', 'is:merged')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice, this way I would not get anymore the typescript error telling me that there are some attributes missing.

However, I doubt that your third point may work, because if the closed filter is ON, it's query would not have the is:closed filter, so the .replace('is:closed', 'is:merged') will not work. That's why I prefer the way it is.

Or maybe I must choose the open link to clone if the closed link is selected, and vice versa. This way, i will always have the /is:closed|is:open/ string to replace by is:merged... I'm gonna give it a try!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've done it. Before calling the function to create the merge link, I check which link I have available on the current page: open, closed or total, and which one is selected. After this check, I clone the appropiate link using cloneNode and send it to the function so it can make the right search query. The fix is uploaded.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Always prefer less code, that's the point of using cloneNode instead of creating a new link. All those conditions aren't readable.

Also I suggested the function name addMergeLink because it should literally add the merge link, on its own, without external help. It's easier to reason about functions when they're self-contained.

Refer to 872cd8a

@fregante fregante self-assigned this Feb 2, 2020
@fregante

fregante commented Feb 2, 2020

Copy link
Copy Markdown
Member

I left a couple of review comments to help improve the code for future PRs ^_^

@KarlHeitmann

Copy link
Copy Markdown
Contributor Author

I left a couple of review comments to help improve the code for future PRs ^_^

Thank you Fregante, very kind. I'm gonna review the new commits and comments.

@fregante
fregante merged commit b59513e into refined-github:master Feb 7, 2020
@fregante

fregante commented Feb 7, 2020

Copy link
Copy Markdown
Member

Thanks Karl 🦙

@KarlHeitmann

Copy link
Copy Markdown
Contributor Author

Happy to help! See you on the next commit 😄

@fregante fregante mentioned this pull request Feb 28, 2020
@yakov116

yakov116 commented Mar 2, 2020 •

Copy link
Copy Markdown
Member

Looks Like this stopped working :(

OK looks like this will work if your screen is small enough since there are 2 bars. One for smaller screens and one for bigger (Like mine)

The smaller one, the element above has the class d-block d-lg-none no-wrap and d-lg-none = me!. The feature was only added for smaller screens.

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.

Remove is:open/is:closed issue search query with a click

4 participants