Skip to content

Allow following a repo releases in 2 clicks  #6090

Closed

Description

@fregante

Description

I think generally I only follow releases on repos, so I think it should be easier to do that. Currently it requires 4 clicks but maybe we can reduce it to two.

Related

Before

Screen Shot 5Screen Shot 6

After

Screen Shot 7

Example URLs

https://github.com/refined-github/refined-github

Activity

  1. yakov116 commented on Oct 19, 2022

    @yakov116
    Member

    I would love if #3005 was done first

  2. fregante commented on May 15, 2023

    @fregante
    MemberAuthor

    I think this would work great on the Releases page as a "Follow releases" button, especially now that the Watch dropdown is relegated to the Code tab.

    It could work as a one-way button, if you're not following the repo:

    Screenshot

    If you're following the releases OR "every event in the repo", show the status, but disabled:

    Screenshot 6

    Then somehow we can inform the user that they can unfollow the repo or change the watch status in the Code tab.

    This is because if the user is following the whole repo, we can't just unfollow the releases.

    This button can probably be built directly via API:

    1. fetch status via API
    2. create button
    3. on click, post to API
      1. update+disable button
  3. fregante commented on Nov 22, 2023

    @fregante
    MemberAuthor

    I looked into this, it doesn't look like neither the REST nor the GQL API offers even a way to check whether the user is subscribed to releases. Subscriptions are handled everywhere as yes | no | ignored. "Repo releases" are not a "subscribable entity" either.

    So on the repo root:

    1. check the DOM
    2. submit the specific form and authenticity_token found

    On the releases page:

    1. Fetch the repo root first
    2. same
    3. same
  4. fregante commented on Nov 18, 2024

    @fregante
    MemberAuthor

    This just got super easy:

    fetch("https://github.com/notifications/subscribe", {
        "body": "------WebKitFormBoundary4OIWfKa9z5KrGJQU\r\nContent-Disposition: form-data; name=\"do\"\r\n\r\ncustom\r\n------WebKitFormBoundary4OIWfKa9z5KrGJQU\r\nContent-Disposition: form-data; name=\"repository_id\"\r\n\r\n402758072\r\n------WebKitFormBoundary4OIWfKa9z5KrGJQU\r\nContent-Disposition: form-data; name=\"thread_types[]\"\r\n\r\nRelease\r\n------WebKitFormBoundary4OIWfKa9z5KrGJQU--\r\n",
        "cache": "default",
        "credentials": "include",
        "headers": {
            "Accept": "*/*",
            "Accept-Language": "en-US,en;q=0.9",
            "Content-Type": "multipart/form-data; boundary=----WebKitFormBoundary4OIWfKa9z5KrGJQU",
            "GitHub-Verified-Fetch": "true",
        },
        "method": "POST",
        "mode": "cors",
        "redirect": "follow",
        "referrer": "https://github.com/refined-github/sandbox",
        "referrerPolicy": "no-referrer-when-downgrade"
    })

    I captured this native request from GitHub's new form. The body is just a FormData and the repo ID is in a meta tag

    const formData = new FormData();
    formData.set('do', 'custom');
    formData.set('repository_id', '402758072');
    formData.set('thread_types[]', 'Release');

    The GET can be done by fetching and parsing GitHub's partial:

    JSON.parse(await fetchDom('https://github.com/notifications/402758072/watch_subscription', 'script[data-target="react-partial.embeddedData"]'))

    The number is the repository_id, the data lives in the <script type="application/json" data-target="react-partial.embeddedData"> element.

  5. added
    Please! ♥︎
    on Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Please! ♥︎acceptedenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions