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

IBX-6856: Added mimeTypes field to ImageFormMapper #1021

Merged
merged 10 commits into from
Dec 14, 2023

Conversation

ciastektk
Copy link
Contributor

@ciastektk ciastektk commented Dec 1, 2023

Question Answer
Tickets https://issues.ibexa.co/browse/IBX-6856
Bug fix? no
New feature? yes
BC breaks? no
Tests pass? yes
Doc needed? yes
License GPL-2.0

ibexa/core#300
ibexa/content-forms#55
https://github.com/ibexa/image-editor/pull/80

Screen Shot 2023-12-04 at 13 04 24

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

{
$mimeTypeChoiceList = [];
foreach ($this->allowedMimeTypes as $mimeType) {
$extensions = implode(', ', $this->mimeTypes->getExtensions($mimeType));
Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion we should display extensions in the following format *.png, *.jpg to indicate the list contains actual file extensions. Also it would help to avoid displaying labels like png (png), instead you'll get png (*.png).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this, but I will ask Ida for confirmation before I provide changes.

Copy link
Contributor Author

@ciastektk ciastektk Dec 4, 2023

Choose a reason for hiding this comment

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

Approved by Design Team
697a859

@webhdx webhdx requested a review from a team December 4, 2023 10:38
@ciastektk ciastektk requested a review from webhdx December 4, 2023 12:04
@konradoboza konradoboza requested a review from a team December 5, 2023 07:53
Base automatically changed from ibx-6937-used-number-type-field-to-set-image-max-size to main December 6, 2023 08:00
@ciastektk ciastektk force-pushed the ibx-6856-added-mime-types-field-to-image-form-mapper branch from bfa6283 to 9efe22c Compare December 6, 2023 08:45
Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

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

Tested all the 4 PRs together.

It works well for the Image fieldtype, but there are two issues with the ImageAsset fieldtype:

Issue 1

If a non-allowed image type is uploaded to the system using the ImageAsset fieldtype then the upload fails (that's expected) but the error is not handled in a nice way

Steps:

  1. Create a CT with an imageasset fieldtype - set the limitation that only GIFs are allowed
  2. Start creating a Content Item of that type
  3. Select "Browse" and upload a JPG file

In other cases - for example when the image size is too big - the error is handled as it should be.

Zrzut ekranu 2023-12-7 o 13 28 55

Issue 2

Entering Version comparison for an Image Asset fieldtype results in an error.

Steps:

  1. Create a Content Type with image asset fieldtype
  2. Create a Content Item of that Content Type
  3. Go to Versions -> Enter version comparison
  4. Switch to Single view
Zrzut ekranu 2023-12-7 o 13 31 35

@mnocon
Copy link
Contributor

mnocon commented Dec 7, 2023

Also a suggestion (maybe we should consult the UX team how it should be done)

Can we display the allowed mime types like we do for filesize?

Zrzut ekranu 2023-12-7 o 13 51 43

Currently it looks like this - there's no way of telling that only JPGs are supported, you have to publish the image to find out what's allowed.

@ciastektk
Copy link
Contributor Author

ciastektk commented Dec 8, 2023

Also a suggestion (maybe we should consult the UX team how it should be done)

Can we display the allowed mime types like we do for filesize?

Currently it looks like this - there's no way of telling that only JPGs are supported, you have to publish the image to find out what's allowed.

I added section with allowed mime types:

ibexa/content-forms@e08900b
d9ccf3e
Screen Shot 2023-12-08 at 08 55 02

Fix for Issue 2: ibexa/core@93eaa4a

@mnocon
Copy link
Contributor

mnocon commented Dec 8, 2023

Thanks! Issue 2 is gone 💪

About the suggestion for user - it looks good now, just one, tiny nitpick: can we add a space between the various types so it's easier to read?
Zrzut ekranu 2023-12-8 o 14 25 48

@ciastektk
Copy link
Contributor Author

Thanks! Issue 2 is gone 💪

About the suggestion for user - it looks good now, just one, tiny nitpick: can we add a space between the various types so it's easier to read? Zrzut ekranu 2023-12-8 o 14 25 48

Fixed: 30417e4

@lserwatka
Copy link
Contributor

lserwatka commented Dec 8, 2023

I don't like this design to be frank. @NataliaBecla can we do better here? Mime Types is a technical language. Why not just come up with a mapping and display to end user something like ".png, .jpg, .jpeg, .gif" etc. This is more understandable. @SylvainGuittard @adamwojs

@webhdx
Copy link
Contributor

webhdx commented Dec 11, 2023

@lserwatka This is the same conclusion we came up with when @ciastektk added mime type configuration in field settings. The list also shows possible file extensions on top of mime types.

@konradoboza konradoboza requested review from dew326, mnocon and a team December 12, 2023 12:34
@konradoboza
Copy link
Contributor

konradoboza commented Dec 12, 2023

Added JS validation to the file input, so issue 1 should be gone now. Also, mime-types were replaced by the extensions when displaying notice. Updated corresponding content-forms PR as well, please check ibexa/content-forms@841fabf.

@konradoboza konradoboza force-pushed the ibx-6856-added-mime-types-field-to-image-form-mapper branch 2 times, most recently from a4b9cb7 to e38ca94 Compare December 12, 2023 12:56
@mnocon
Copy link
Contributor

mnocon commented Dec 14, 2023

Issue 1 is now gone 🎉

Zrzut ekranu 2023-12-14 o 14 00 21

New things that I've found:

1. For Image fieldtype the validation is now displayed twice

Zrzut ekranu 2023-12-14 o 13 48 22

2. The translations for alternative text in image asset is missing

Zrzut ekranu 2023-12-14 o 14 03 08

This one is also happening on Nightly

3. The displayed message is not consistent with the design

Design: https://www.figma.com/file/4sbNQyNLhFFwxWDH89Rf9X/%F0%9F%9F%A2-Ibexa-Design-System?type=design&node-id=3329%3A445543&mode=design&t=ltb1PxLccYC7CM63-1

Design:
obraz

Actual:
obraz

(also the look of other states is not consistent with the Figma design)

Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

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

I will report these issues as follow-ups, so that we can tackle them in the future - the core mechanics are in place now 👍

@ciastektk ciastektk force-pushed the ibx-6856-added-mime-types-field-to-image-form-mapper branch from e38ca94 to 098d250 Compare December 14, 2023 13:26
Copy link

sonarcloud bot commented Dec 14, 2023

Quality Gate Failed Quality Gate failed

Failed conditions

14.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@ciastektk ciastektk merged commit 719f2cf into main Dec 14, 2023
15 of 23 checks passed
@ciastektk ciastektk deleted the ibx-6856-added-mime-types-field-to-image-form-mapper branch December 14, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature request Ready for QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants