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

Switch to ImageBlock #503

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Chiemezuo
Copy link
Contributor

This is a follow-up to #480

I removed the patch (and the resulting older migrations) as the issues it addressed were fixed in Wagtail 6.4.

I also rebased so I could preserve the commit authors and their history, with a few additions.

Stormheg and others added 6 commits February 26, 2025 00:38
… to ImageBlock

On this site, most images have pretty decent titles so using them while we are converting from
ImageChooserBlock to ImageBlock often produces the alt text you likely would have written
anyway. Inserting it during the first page save makes this conversion a lot easier for our editors.
@Chiemezuo Chiemezuo changed the title Storm imageblock migration Switch to ImageBlock Feb 26, 2025
@vossisboss
Copy link
Contributor

After testing all the blocks where ImageBlock occurs locally, it seems every block that includes the new ImageBlock is functioning properly. There were no issues with saving, updating, or publishing any images with the new version of the block. The only issue, which is an ongoing bug that needs to be solved in core, was the repeating of the word "Image" in blocks that were built using StructBlock. Like in this screenshot here:

Screenshot 2025-03-05 at 4 42 10 PM

The benefits of implementing the new block outweigh the issue of having the word image appear twice in my opinion. I think implementing this block to improve our alt text is more important. This issue needs to be properly logged and addressed in future versions of Wagtail Core though.

@vossisboss
Copy link
Contributor

I've asked @Chiemezuo to rename the migration files so that they better describe the change being made with each migration.

Copy link
Contributor

@vossisboss vossisboss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right @Chiemezuo, after doing my initial testing and review, there are a few things that need to be addressed.

As we discussed on the call, it would be really helpful if all the migration files had a more descriptive change to let future maintainers know what changes were made by the migration.

I also found a few instances where ImageChooserBlock was not updated to the new ImageBlock and I would like to know whether those were deliberate choices or whether there were a few instances you missed. If you could go through those and also search the project files for remaining instances that need to be replaced, that would be great.

I am also curious about the update needed to our custom image model. I'd just like to know a bit more about why it's necessary. And we'll want to test this on staging.wagtail.org for sure to make sure any changes to the model don't lead to database problems with our existing images.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume adding this Field to our custom image model is necessary for the alt text? I thought the new ImageBlock was interchangeable with ImageChooserBlock, so I'm just curious why this change is necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this migration file to be more descriptive. Something like 0014_add_new_imageblock.py

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this migration file to be more descriptive. Something like 0014_add_new_imageblock.py

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this migration file to be more descriptive. Something like 0014_add_new_imageblock.py

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this migration file to be more descriptive. Something like 0014_add_new_imageblock.py

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this migration file to be more descriptive. Something like 0014_add_new_imageblock.py

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is an instance of ImageChooserBlock left in this file that wasn't replaced by the new ImageBlock. Did you not change it because it wasn't changed in the prior PR @Chiemezuo? Or do you have another reason for leaving it be?

See line 109 in the LogoCardBlock.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also looks like there is another instance of ImageChooserBlock in line 463 in LogoBlock.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is another instance of ImageChooserBlock on Line 22 under CardBlock. Is there a reason we're not changing this one? If not, we should probably see if the new ImageBlock works well here.

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.

4 participants