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

Add the ability to specify alt text for image posts #1640

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

micahmo
Copy link
Member

@micahmo micahmo commented Dec 13, 2024

Pull Request Description

This PR adds the ability to specify alternative text for images when creating an image post.

Notes:

  • I was anticipating the need to add a way for optional fields to be collapsible on the create post page. However, as I was testing this feature, it occurred to me that if the URL field is populated with an image, which is the only case in which we show the alt text field, then we don't also show the custom thumbnail field. So we will only ever show one or the other, and as a result, the alt text field does not occupy any additional space on the create post page. We still may want to make some fields collapsible in the future, but I don't think it needs to be right now.
  • I verified that drafts as well as edits work properly with the new field. Do note that the post page needs to be refreshed to see the new alt text. I think it would be a separate PR if we wanted to "fix" that.
  • Along with #1323 and #1638, this should be the last change needed to bring Thunder in parity with new Lemmy server features added in 0.19.4 (or at least all the ones we planned on adding)!
  • I'm not sure why there are so many changes to database.g.dart. Below are my steps for updating the database. Let me know if I did anything wrong! Also, I don't think we've officially documented how to update the db since #1501, so if what I did is anything close to "right", maybe we should add it to the README. 😊

  1. Update schema version in lib\core\database\database.dart.
  2. Add new tables/columns in lib\core\database\tables.dart.
  3. Export schema
    • dart run drift_dev schema dump lib/core/database/database.dart drift_schemas/
  4. Update migrations
    • dart run drift_dev schema steps drift_schemas/ lib/core/database/schema_versions.dart
  5. Go back to lib\core\database\database.dart and implement the migration function
  6. Update the auto-generated db table models
    • dart run build_runner build
  7. Reformat the auto-generated files
    • dart format --set-exit-if-changed -l 200 lib

Issue Being Fixed

Issue Number: #1447

Screenshots / Recordings

alt.text.mp4

Checklist

  • If a new package was added, did you ensure it uses an appropriate license and is actively maintained?
  • Did you use localized strings (and added appropriate descriptions) where applicable?
  • Did you add semanticLabels where applicable for accessibility?

@micahmo micahmo mentioned this pull request Dec 13, 2024
7 tasks
@micahmo
Copy link
Member Author

micahmo commented Dec 17, 2024

I just realized/remembered that there is no downgrade migration strategy as of #1501. This means if someone is testing this branch, they will have a hard time going to any other branch (I learned that the hard way!). I did a little bit of research and as you found, @hjiangsu, drift doesn't really support downgrades natively like they do upgrades. Therefore, I added some code to manually handle downgrades. While it's not as elegant, I think it should work. The major benefit to the approach we were using prior to #1501 is that this supports step-wise downgrades, to perform one rollback at a time.

Note that I only added a downgrade for the change included in this PR, mainly so I can work on other stuff lol, but we can go back and add others later.

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.

1 participant