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

Hotfix missing discussion items url #487

Closed
wants to merge 4 commits into from
Closed

Conversation

Yago
Copy link

@Yago Yago commented Mar 18, 2021

I'm aware it's not super clean, but it does the trick until Github fix its REST API (see #424). If so, the first test will pass and this code will never reach out again and we will be able to remove it without second thought 😉

Again, it's just an idea for the mean time, feel free to say that it's a bad idea. I didn't update the test due to the very “temporary” aspect of this code, but I can do so if needed.

Copy link
Collaborator

@codebytere codebytere left a comment

Choose a reason for hiding this comment

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

Thanks! Looking good, just a cleanup comment.

@@ -35,6 +35,18 @@ export const NotificationRow: React.FC<IProps> = ({
const url = generateGitHubWebUrl(notification.subject.url);
shell.openExternal(url);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

We know the first and third conditionals will always be true at this point of code execution, so we probably can clean this up a little bit:

    // Some Notification types from GitHub are missing urls in their subjects.
    if (notification.subject.url) {
      const url = generateGitHubWebUrl(notification.subject.url);
      shell.openExternal(url);
    // For discussions, we can at least send users to the main discussions page.
    } else if (notification.subject.type === SubjectType.Discussion) {
      const url = generateGitHubWebUrl(`${notification.repository.url}/discussions`);
      shell.openExternal(url);
    }

Copy link
Author

Choose a reason for hiding this comment

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

Done 😉

@Luflosi
Copy link
Contributor

Luflosi commented Oct 18, 2021

What's the status of this? I'd really like to be able to click notifications to open discussions.

@Yago
Copy link
Author

Yago commented Oct 19, 2021

I'll do the cleanup asap 😉

@setchy
Copy link
Member

setchy commented Nov 27, 2021

Looking forward to this enhancement. Thanks @Yago for contributing this PR

@setchy
Copy link
Member

setchy commented Dec 16, 2021

@manosim - do you think this enhancement is ready to merge and release?

@Araxeus
Copy link
Contributor

Araxeus commented Mar 5, 2022

we can get the Discussion thread url using GraphQL search

I have created a repo to easily test this: https://github.com/Araxeus/github_discussion_notification_url

Any thoughts? (the graphQL query logic is exclusively in https://github.com/Araxeus/github_discussion_notification_url/blob/main/graphql.js)

EDIT: I've opened a PR #538 which uses that logic and in case it fails, defaults to the the method here

@Araxeus Araxeus mentioned this pull request Mar 5, 2022
5 tasks
@afonsojramos
Copy link
Member

afonsojramos commented Sep 14, 2023

Will merge #538 over this one. Thank you to everyone involved!!!

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

Successfully merging this pull request may close these issues.

6 participants