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

refactor: simplify notification html url logic #793

Merged
merged 19 commits into from Feb 22, 2024

Conversation

setchy
Copy link
Member

@setchy setchy commented Feb 19, 2024

Fetch the most appropriate html url for the notification based off the notification API response.

Order is

  • notification last_comment_url
  • notification subject url
  • discussions specific lookup (not available via the notifications api)
  • default, repository url

Removes or simplifies a lot of string manipulation to generate the link, add in comment anchors and referrer ids.

Note: tests still need to be reworked given the logic changes in helper.ts

@setchy setchy changed the title refactor: simplify open url logic refactor: simplify notification html url logic Feb 19, 2024
src/utils/helpers.ts Outdated Show resolved Hide resolved
src/utils/helpers.ts Outdated Show resolved Hide resolved
@setchy setchy marked this pull request as ready for review February 21, 2024 20:28
@setchy
Copy link
Member Author

setchy commented Feb 21, 2024

This PR is now ready for review @afonsojramos @bmulholland.

In addition to simplifying the html_url logic (no more string manipulation), this now has increased unit test coverage, and in doing so resolved an edge-base bug for Discussions url generation.

@bmulholland
Copy link
Collaborator

Yep, LGTM!

@setchy setchy merged commit ff46170 into gitify-app:main Feb 22, 2024
7 checks passed
@setchy setchy deleted the refactor/open-url branch February 22, 2024 20:03
adufr pushed a commit to adufr/gitify that referenced this pull request Mar 25, 2024
* refactor: simplify html url

* fix: add test coverage
@setchy setchy added the refactor Refactoring of existing feature label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants