Remove "default" image description #493
Merged
floatingghost
merged 1 commits from ilja/akkoma:remove_default_image_description
into develop
2 months ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'ilja/akkoma:remove_default_image_description'
Deleting a branch is permanent. It CANNOT be undone. Continue?
When no image description is filled in, Pleroma allowed fallbacks. Those were (based on a setting) either the filename, or a fixed description. Neither seem good options for image descriptions to me, so here we remove this.
I tried to find why these options were added. It seems it was first added in https://git.pleroma.social/pleroma/pleroma/-/merge_requests/470/diffs#0da54a09a904d56b49c5a55e7c96f270264a0c77_32_25. I didn't dig deeper, but at first glance it looks like
name
was originally meant for the filename. This makes sense since the AP field is also called that and says it's meant for a plain-text human-readable name (https://www.w3.org/TR/activitystreams-vocabulary/#dfn-name). I assume Mastodon started using it for image description because "summary" is html in AP and plain-text makes more sense. So Pleroma also started doing this, but kept the filename as fallback. The fallback became an option in https://git.pleroma.social/pleroma/pleroma/-/commit/aabc26a57327b15c1aa5ee9980b7542c9e2f4899, who also introduced an option for a fixed description. I have no idea why that option was added.EDIT: I just stumbled upon this https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3854. It seems Mastodon understands
summary
, but usesname
as fallback for incoming objects. The "proper" way to do this is then probably to always have asummary
field, and either don't usename
or fill it in with the filename. But that may mean that we have to rewrite every object in the database o.O (I still need to check this to be sure). I'm also not sure how other implementations (ie foundkey) handle this.So I see three possible routes here:
summary
field so maybe it can be looked at on a later date.summary
thing. This can take a while and I'm unsure of the eventual result.summary
field so maybe it can be looked at on a later date.I leave that choice up to the discretion of the maintainers ;)
301171cc7c
tob57e0fe4e6
3 months agoWIP: Remove "default" image descriptionto Remove "default" image description 3 months ago{:ok, data} = Upload.store(file)
assert data["name"] == "an [image.jpg"
end
Note: This test broke with removing the filename from this field. But this is not what it tests, and as afaict it doesn't even actually tests what it's supposed to do. Therefore I decided to just remove it instead of leaving it in what seems to be a broken state.
b57e0fe4e6
to6c396fcab4
3 months agoseems good! just one little nitpick
upload = %__MODULE__{upload | path: upload.path || "#{upload.id}/#{upload.name}"},
{:ok, upload} <- Pleroma.Upload.Filter.filter(opts.filters, upload),
description = get_description(opts, upload),
description = Map.get(opts, :description) || "",
might be cleaner is use
Map.get/3
here insteadMap.get/3
doesn't work in this case. The key can containnil
. So in that case the description would benil
instead of an empty string (and the rest of the code expects a string).ah yeah , forgot that it could be explicitly nil , I'm stupid
8c86a06ed1
into develop 2 months ago8c86a06ed1
.