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

notifications.30s.py: add support for Discussions notifications #1985

Open
gingerbeardman opened this issue Sep 1, 2023 · 1 comment
Open

Comments

@gingerbeardman
Copy link
Collaborator

gingerbeardman commented Sep 1, 2023

Problem

As-is the GitHub Notifications xbar script does not support opening Discussions notifications.

Solution

So, I've added a rudimentary way of opening repo Discussions, filtering the search to show the discussion with the correct title. You will have to click into it to read it.

This is less than ideal, but better than nothing.

How

  1. add this near the top of def format_notification(notification): after the formatted = ... definition
    if type == "Discussion":
        formatted["href"]= notification["repository"]["html_url"] + "/discussions?discussions_q=" + urllib.parse.quote(formatted["title"])
  1. add this image data for Discussions notifications:
    elif type == "Discussion":
        formatted[
            "image"
        ] = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAjklEQVR42qXMtUHFYBRA4Q/WyF5UlMgOuLtNFanYIm2kwi8Oz/WcX68Zz4rKW4+VFX80cvs9Fmp/hF297Ancq6yMKlhSqIcX/N3zFzRSGxKwbMeHMs1/wbpW2MK18G1rrWuSsOdauLNo4UNIbPxN8qIU7gCFE2z7n+RE6xDAhXBlTxjKnVB6MIIztVOT8A7rHFO4O8LaZAAAAABJRU5ErkJggg=="
        formatted["templateImage"] = formatted.pop("image")

To Do

  • figure out the URL to open to the individual discussion directly
@gingerbeardman gingerbeardman changed the title notifications.30s.py: add rudimentary support for Discussions notifications notifications.30s.py: add support for Discussions notifications Sep 1, 2023
@gingerbeardman
Copy link
Collaborator Author

Updated, simplified, improved.

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

No branches or pull requests

1 participant