Remove "default" image description #493
No reviewers
Labels
No labels
approved, awaiting change
bug
cannot reproduce
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs change/feedback
needs docs
needs tests
not a bug
not our bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AkkomaGang/akkoma!493
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ilja/akkoma:remove_default_image_description"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. 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
namewas 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 usesnameas fallback for incoming objects. The "proper" way to do this is then probably to always have asummaryfield, and either don't usenameor 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:
summaryfield so maybe it can be looked at on a later date.summarything. This can take a while and I'm unsure of the eventual result.summaryfield so maybe it can be looked at on a later date.I leave that choice up to the discretion of the maintainers ;)
301171cc7cb57e0fe4e6WIP: Remove "default" image descriptionto Remove "default" image description@ -166,4 +157,0 @@{:ok, data} = Upload.store(file)assert data["name"] == "an [image.jpg"endNote: 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.
b57e0fe4e66c396fcab4seems good! just one little nitpick
@ -83,3 +74,3 @@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/3here insteadMap.get/3doesn't work in this case. The key can containnil. So in that case the description would benilinstead 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