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

Broken comment avatars #697

Closed
aadilayub opened this issue Feb 15, 2024 · 9 comments
Closed

Broken comment avatars #697

aadilayub opened this issue Feb 15, 2024 · 9 comments
Labels
Needs triage Stale [Type] Bug Something isn't working

Comments

@aadilayub
Copy link

Quick summary

Avatars on activitypub comments become broken after the URL for the user's avatar changes on Mastodon's side.

Specifically, the first comment on this post.

image

The avatar used to load before, but now it's broken.

Steps to reproduce

I'm not sure how to give instructions to reproduce this, since it requires that someone else comments on your site and the URI for their avatar changes.

What you expected to happen

Every comment has a functional avatar. In the absence of an avatar, a fallback placeholder avatar is used.

What actually happened

When the comment author's avatar is not reachable, it results in a broken image on your site.

Impact

One

Available workarounds?

No but the platform is still usable

Logs or notes

Looking at the HTML, the comment by my friend uses this URL for the avatar:

https://sunbeam.city/system/accounts/avatars/000/038/480/original/a12605bee7e9406e.jpg

When I go to their profile on Mastodon and click inspect element on their avatar, I see that the actual URI for their avatar is

https://sunbeam.city/system/accounts/avatars/000/038/480/original/73da25f84ad489a3.jpg

@aadilayub aadilayub added [Type] Bug Something isn't working Needs triage labels Feb 15, 2024
@janboddez
Copy link
Contributor

janboddez commented Feb 16, 2024

Related: #568.

That issue was closed because there is a follower update cron. (I noticed the issue in the context of followers' avatars.)

Not sure if a "commenter updater" is feasible. Storing them locally is what I do now, for a default duration of one month. Which people may not like, because it won't immediately reflect changes made on their end. (In fact, I think I may never update old comments. I'm not too sure anymore.) And so on.

Interested to hear about a better solution.

@aadilayub
Copy link
Author

Is there a workaround to manually edit/update the avatar?

@janboddez
Copy link
Contributor

The URL, I believe, is stored in a custom meta field (or custom post field). If you know a bit of SQL, it could be updated that way (but it is rather tedious).

There are other ways, but nothing easy. (I personally use a custom add-on plugin that fetches the avatar and stores it locally, and overwrites the aforementioned custom field with the "local" URL.)

I was initially also thinking of an extra field on the "Edit Comment screen" where one could view and possibly even edit the URL, but I'm afraid future versions of the plugin will make it harder to even access this screen (for "Fediverse comments," at least, the reasoning being that site admins shouldn't be able to just go and change other people's [remote] replies).

Copy link

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jun 21, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2024
@janboddez
Copy link
Contributor

janboddez commented Jul 11, 2024

I think this is still an issue.

The "solution" would be to locally save avatars (I myself, through an add-on plugin, save them while the URL is being stored, and use a wp-content/uploads subfolder) with file name and path based on the (immutable) actor URL. Then the image may be outdated but at least it won't be broken.

Then if another comment comes in by the same person, the plugin could check whether their avatar got updated (I simply check if the cached version is older than a month and always overwrite it if that's the case) and overwrite it if needed.

Something similar could be done for follower avatars. (I haven't been able to come up with a way to locally save those, as there's no hook [I think] I can call before storing the avatar URL. But it's less of an issue because they should get updated automatically in the background.)

@aadilayub
Copy link
Author

@janboddez what plugin do you use for this?

@janboddez
Copy link
Contributor

janboddez commented Aug 31, 2024

@janboddez what plugin do you use for this?

I personally (and I know this isn't for everyone, but maybe other people could draw inspiration from it) use https://github.com/janboddez/addon-for-activitypub/ in combination with https://wordpress.org/plugins/indieblocks/.

If you were to install both plugins and enabled "Addon for ActivityPub's" "Cache Avatars" setting, comment avatars should get saved locally going forward (all other settings, including all of IndieBlocks' settings, can be disabled).

("IndieBlocks" obviously does a lot more, or can do a lot more, so I understand this isn't, like, ideal. I guess I could always try and port over only its image caching function to "Addon for ActivityPub" in order to no longer also need "IndieBlocks.")

@janboddez
Copy link
Contributor

Update: IndieBlocks is no longer required. Just https://github.com/janboddez/addon-for-activitypub/ should allow for locally caching comment avatars. (If WordPress has "direct filesystem access," I may one day expand this.) Feel free to give it a try.

@aadilayub
Copy link
Author

Thanks! Installed both 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs triage Stale [Type] Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants