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

Adjust the notifications endpoint slightly so the status object of a reblog notification is the original, reblogged post #775

Merged
merged 1 commit into from
Aug 29, 2022

Conversation

blackle
Copy link
Contributor

@blackle blackle commented Aug 29, 2022

pretty minor change to bring the endpoint more in line with mastodon behaviour. the mastodon implementation of this endpoint puts the original, reblogged status in the "status" field of the "reblog" notification, instead of the reblogging user's status that includes the original status in the "reblog" field. to explain better, here's a "reblog" notification from a mastodon instance:

long json snippet
{
    "id": "8977162",
    "type": "reblog",
    "created_at": "2022-08-29T03:26:10.907Z",
    "account": {
        "id": "263434",
        "username": "aphyr",
        "acct": "aphyr@woof.group",
        "display_name": "Bear Traffic Control",
        "locked": false,
        "bot": false,
        "discoverable": true,
        "group": false,
        "created_at": "2019-12-17T17:55:50.913Z",
        "note": "<p>Switchy leatherman into bad puns, thick boys, and distributed systems. <span class=\"h-card\"><a href=\"https://woof.group/@Daddy\" class=\"u-url mention\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">@<span>Daddy</span></a></span>'s boy. Purveyor of fine jockstrap selfies.</p><p>Jim Starkey: \"Of interest only to third-rate academics a few papers short of a tenure package.\"</p><p>Reddit: \"would never ever ever hire this degenerate holy shit\"</p><p>Peter Watts: \"The most innovative fanfic I've ever read.\"</p>",
        "url": "https://woof.group/@aphyr",
        "avatar": "https://cybre.ams3.digitaloceanspaces.com/accounts/avatars/000/263/434/original/1c3368137fe4cd2e.jpeg",
        "avatar_static": "https://cybre.ams3.digitaloceanspaces.com/accounts/avatars/000/263/434/original/1c3368137fe4cd2e.jpeg",
        "header": "https://cybre.ams3.digitaloceanspaces.com/accounts/headers/000/263/434/original/42a2e82f8e6f89cd.jpeg",
        "header_static": "https://cybre.ams3.digitaloceanspaces.com/accounts/headers/000/263/434/original/42a2e82f8e6f89cd.jpeg",
        "followers_count": 1466,
        "following_count": 767,
        "statuses_count": 8389,
        "last_status_at": "2022-08-29",
        "emojis": [],
        "fields": [
            {
                "name": "Blog",
                "value": "<a href=\"https://aphyr.com\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">aphyr.com</span><span class=\"invisible\"></span></a>",
                "verified_at": null
            },
            {
                "name": "Leather Blog",
                "value": "<a href=\"https://blog.woof.group/aphyr\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">blog.woof.group/aphyr</span><span class=\"invisible\"></span></a>",
                "verified_at": null
            },
            {
                "name": "Work",
                "value": "<a href=\"https://jepsen.io\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">jepsen.io</span><span class=\"invisible\"></span></a>",
                "verified_at": null
            },
            {
                "name": "Pronouns",
                "value": "He/Him",
                "verified_at": null
            }
        ]
    },
    "status": {
        "id": "108902977987723865",
        "created_at": "2022-08-28T22:59:29.525Z",
        "in_reply_to_id": null,
        "in_reply_to_account_id": null,
        "sensitive": false,
        "spoiler_text": "",
        "visibility": "public",
        "language": "en",
        "uri": "https://cybre.space/users/SuricrasiaOnline/statuses/108902977987723865",
        "url": "https://cybre.space/@SuricrasiaOnline/108902977987723865",
        "replies_count": 20,
        "reblogs_count": 5,
        "favourites_count": 5,
        "favourited": false,
        "reblogged": false,
        "muted": false,
        "bookmarked": false,
        "pinned": false,
        "content": "<p>anyone know of any novel ways to produce a pseudo random sequence with nothing but your brain and a pen and paper? (potentially with other paper with a reusable cypher or something)</p><p>methods that avoid needing to do math in your head are a plus</p>",
        "reblog": null,
        "application": {
            "name": "Pinafore",
            "website": "https://pinafore.social"
        },
        "account": {
            "id": "125507",
            "username": "SuricrasiaOnline",
            "acct": "SuricrasiaOnline",
            "display_name": "Shark Blackle",
            "locked": false,
            "bot": false,
            "discoverable": true,
            "group": false,
            "created_at": "2018-08-19T06:42:08.033Z",
            "note": "<p>I do lots of random stuff because my brain has too many chemicals inside of it. 1994 ⚧</p>",
            "url": "https://cybre.space/@SuricrasiaOnline",
            "avatar": "https://cybre.ams3.digitaloceanspaces.com/accounts/avatars/000/125/507/original/75a79b617c9c564a.jpg",
            "avatar_static": "https://cybre.ams3.digitaloceanspaces.com/accounts/avatars/000/125/507/original/75a79b617c9c564a.jpg",
            "header": "https://cybre.ams3.digitaloceanspaces.com/accounts/headers/000/125/507/original/180716f637e7e459.png",
            "header_static": "https://cybre.ams3.digitaloceanspaces.com/accounts/headers/000/125/507/original/180716f637e7e459.png",
            "followers_count": 2425,
            "following_count": 2188,
            "statuses_count": 18189,
            "last_status_at": "2022-08-29",
            "emojis": [],
            "fields": [
                {
                    "name": "website",
                    "value": "<a href=\"https://suricrasia.online/\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">suricrasia.online/</span><span class=\"invisible\"></span></a>",
                    "verified_at": "2018-12-06T20:00:13.225+00:00"
                },
                {
                    "name": "location",
                    "value": "toronto",
                    "verified_at": null
                },
                {
                    "name": "pronunciation",
                    "value": "<a href=\"https://www.youtube.com/watch?v=wWubxZ-fSxU\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"ellipsis\">youtube.com/watch?v=wWubxZ-fSx</span><span class=\"invisible\">U</span></a>",
                    "verified_at": null
                },
                {
                    "name": "pronouns",
                    "value": "it/its",
                    "verified_at": null
                }
            ]
        },
        "media_attachments": [],
        "mentions": [],
        "tags": [],
        "emojis": [],
        "card": null,
        "poll": null
    }
}

note that status.reblog == null.

the only real effect of this api difference was pinafore would show reblogs with the same font colour as replies, instead of being greyed out. this PR fixes that

…reblog notification is the original, reblogged post
@blackle blackle force-pushed the notifications-reblog branch from 6e61329 to 0b5bf48 Compare August 29, 2022 04:15
@tsmethurst
Copy link
Contributor

good catch! this area of the code can probably be tidied up and made a bit more efficient (it's quite old code now), but for now I'll merge this since it fixes the immediate issue

@tsmethurst tsmethurst merged commit 3ce26a6 into superseriousbusiness:main Aug 29, 2022
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.

2 participants