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

Handle Hubzilla Likes better #941

Closed
snarfed opened this issue Apr 7, 2024 · 5 comments
Closed

Handle Hubzilla Likes better #941

snarfed opened this issue Apr 7, 2024 · 5 comments
Labels
compat Protocol differences that need special handling. now

Comments

@snarfed
Copy link
Owner

snarfed commented Apr 7, 2024

We don't currently translate Hubzilla Like activities to mf2 HTML very well. They have both object and inReplyTo, which arguably they shouldn't, but probably isn't technically wrong. We convert them to a combined reply and like as mf2, which webmention receivers like the WordPress plugin (cc @dshanske) interpret as a reply over a like. (Which is probably right!)

For AS2 Likes, we should prioritize the like and remove the reply when converting to AS1 and/or mf2.

Example: https://authorship.studio/activity/143b8b1d-0bf8-46ab-b0bf-065e689120cd . Pruned AS2:

{
   "type" : "Like"
   "id" : "https://authorship.studio/activity/143b8b1d-0bf8-46ab-b0bf-065e689120cd",
   "actor" : "https://authorship.studio/channel/scott",
   "inReplyTo" : "https://fed.brid.gy/r/https://snarfed.org/2024-04-07_52743",
   "cc" : ["https://authorship.studio/followers/scott"],
   "object" : {
      "type" : "Note",
      "id" : "https://fed.brid.gy/r/https://snarfed.org/2024-04-07_52743",
      "actor" : "https://fed.brid.gy/snarfed.org",
      "url" : "https://fed.brid.gy/r/https://snarfed.org/2024-04-07_52743"
      "attributedTo" : "https://fed.brid.gy/snarfed.org",
      "content" : "One of our cats purrs so loudly that it’s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke.",
      "published" : "2024-04-07T16:07:49Z",
      "to" : ["https://www.w3.org/ns/activitystreams#Public"],
   },
   "published" : "2024-04-07T16:31:35Z",
   "to" : ["https://www.w3.org/ns/activitystreams#Public"],
}
@snarfed
Copy link
Owner Author

snarfed commented Apr 7, 2024

HTML from https://ap.brid.gy/convert/web/https://authorship.studio/activity/143b8b1d-0bf8-46ab-b0bf-065e689120cd :

<article class="h-entry">
  <span class="p-uid">https://ap.brid.gy/convert/web/https://authorship.studio/activity/143b8b1d-0bf8-46ab-b0bf-065e689120cd</span>
  <time class="dt-published" datetime="2024-04-07T16:31:35+00:00">2024-04-07T16:31:35+00:00</time>
  <span class="p-author h-card">
    <data class="p-uid" value="https://authorship.studio/channel/scott"></data>
    <a class="p-name u-url" href="https://authorship.studio/channel/scott">Scott M. Stolz</a>
    <span class="p-nickname">scott</span>
    <img class="u-photo" src="https://authorship.studio/photo/profile/l/4?rev=1701617226" alt="" />
<img class="u-photo" src="https://authorship.studio/photo/72d44b5e-3c8e-414f-965b-70f2c0da81ec-7" alt="" />
  </span>

  <div class="e-content p-name">
  Likes <a href="https://snarfed.org/2024-04-07_52743">a post</a> by   <span class="h-card">
    <data class="p-uid" value="https://snarfed.org/"></data>
    <a class="u-url" href="https://snarfed.org/">snarfed.org</a>
      </span>
One of our cats purrs so loudly that it’s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke.
  </div>

  <a class="u-in-reply-to" href="https://snarfed.org/2024-04-07_52743"></a>
<article class="u-like-of h-cite">
  <span class="p-uid">https://snarfed.org/2024-04-07_52743</span>
  <time class="dt-published" datetime="2024-04-07T16:07:49+00:00">2024-04-07T16:07:49+00:00</time>

  <a title="snarfed.org/2024-04-07_52743" class="u-url" href="https://snarfed.org/2024-04-07_52743">snarfed.org/2024-04-07_527...</a>
  <div class="e-content p-name">
  One of our cats purrs so loudly that it’s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke.
  </div>
</article>

Parsed mf2 (pruned), https://pin13.net/mf2/?url=https://ap.brid.gy/convert/web/https://authorship.studio/activity/143b8b1d-0bf8-46ab-b0bf-065e689120cd :

{
  "items": [
    {
      "type": ["h-entry"],
      "properties": {
        "uid": ["https://ap.brid.gy/convert/web/https://authorship.studio/activity/143b8b1d-0bf8-46ab-b0bf-065e689120cd"],
        "name": ["Likes a post by snarfed.org One of our cats purrs so loudly that it\u2019s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke."],
        "in-reply-to": ["https://snarfed.org/2024-04-07_52743"],
        "published": ["2024-04-07T16:31:35+00:00"],
        "content": [{
            "html": "Likes <a href=\"https://snarfed.org/2024-04-07_52743\">a post</a> by   <span class=\"h-card\">\n  <data class=\"p-uid\" value=\"https://snarfed.org/\"></data>\n  <a class=\"u-url\" href=\"https://snarfed.org/\">snarfed.org</a>\n  \n  \n  </span>\nOne of our cats purrs so loudly that it&#x2019;s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke.",
            "value": "Likes a post by snarfed.org One of our cats purrs so loudly that it\u2019s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke."
          }
        ],
        "like-of": [{
            "type": ["h-cite"],
            "properties": {
              "uid": ["https://snarfed.org/2024-04-07_52743"],
              "name": ["One of our cats purrs so loudly that it\u2019s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke."],
              "url": ["https://snarfed.org/2024-04-07_52743"],
              "published": ["2024-04-07T16:07:49+00:00"],
              "content": [{
                  "html": "One of our cats purrs so loudly that it&#x2019;s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke.",
                  "value": "One of our cats purrs so loudly that it\u2019s a running joke in our family. It makes her fur vibrate. We have to turn the TV volume up when she sits with us. Once, she was in another room, and I heard her purr through the wall. No joke."
                }]
            },
            "value": "https://snarfed.org/2024-04-07_52743"
          }
        ]
      },
        "author": [{
            "type": ["h-card"],
            "properties": {
              "uid": ["https://authorship.studio/channel/scott"],
              "name": ["Scott M. Stolz"],
              "nickname": ["scott"],
              "url": ["https://authorship.studio/channel/scott"],
              "photo": [{
                  "value": "https://authorship.studio/photo/profile/l/4?rev=1701617226",
                }]
            },
            "value": "Scott M. Stolz"
          }],
    }
  ],
}

@snarfed snarfed added the now label Oct 10, 2024
@snarfed snarfed removed the now label Oct 24, 2024
@Tamschi Tamschi added the compat Protocol differences that need special handling. label Oct 31, 2024
@Tamschi
Copy link
Collaborator

Tamschi commented Oct 31, 2024

It's probably best to go by the "type" : "Like" here instead of prioritising one interpretation by available properties.

@snarfed
Copy link
Owner Author

snarfed commented Oct 31, 2024

Good point!

@snarfed snarfed added the now label Oct 31, 2024
@snarfed
Copy link
Owner Author

snarfed commented Nov 1, 2024

Oh yeah, I remember now. The difficulty here is that mf2 itself is basically untyped, at least for all of the types we care about here. They're all h-entry, and they have like-of, repost-of, in-reply-to, etc properties, which we preserve and translate from the source AS2 regardless of its type.

So the brute force way to fix this is, for each AS2 type, strip all properties that don't apply to it. Eg for a Like, we'd strip inReplyTo. Doable, but it'd be verbose, error-prone, and kind of painful. Sigh.

@snarfed
Copy link
Owner Author

snarfed commented Nov 1, 2024

I took the minimal approach here and just removed in-reply-to from just likes, shares, etc.

snarfed added a commit to snarfed/granary that referenced this issue Nov 1, 2024
when we include both like-of and in-reply-to (or repost-of and in-reply-to, etc) in mf2, it confuses consumers like webmention receivers.

for snarfed/bridgy-fed#941
@snarfed snarfed closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat Protocol differences that need special handling. now
Projects
None yet
Development

No branches or pull requests

2 participants