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

[WEB-2393] chore-Uploading svg's are no more supported in the platform #5646

Closed

Conversation

Jimmycutie
Copy link
Collaborator

@Jimmycutie Jimmycutie commented Sep 18, 2024

Clean Reason

Updated allowed image upload type. Removed .webp image upload and updated the accepting function to only allow jpg's and png.

Implementation

image
image

References

[WEB-2393]

Summary by CodeRabbit

  • New Features

    • Updated image upload modals to accept only JPEG and PNG file formats.
    • Enhanced user interface text to clearly indicate supported formats: .jpeg, .jpg, and .png.
  • Bug Fixes

    • Removed support for previously accepted formats like SVG and WEBP to streamline user experience.

Copy link
Contributor

coderabbitai bot commented Sep 18, 2024

Walkthrough

The pull request introduces changes to the image upload functionality across three components: ImagePickerPopover, UserImageUploadModal, and WorkspaceImageUploadModal. The modifications restrict accepted image file formats to only JPEG and PNG, explicitly removing support for WEBP and other formats. Corresponding user interface text has been updated to reflect these changes, ensuring clarity on the supported formats for users.

Changes

File Path Change Summary
web/core/components/core/image-picker-popover.tsx, web/core/components/core/modals/user-image-upload-modal.tsx, web/core/components/core/modals/workspace-image-upload-modal.tsx Updated accepted file formats to only JPEG and PNG; modified user interface text accordingly.

Possibly related PRs

Suggested labels

🌟enhancement

Suggested reviewers

  • SatishGandham
  • anmolsinghbhatia

Poem

🐰 In a world of colors bright,
JPEG and PNG take flight.
WEBP has hopped away,
Now clearer paths for us to play.
With each upload, joy we find,
Simple formats, peace of mind! 🌈


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 244fb8a and 8ae1063.

Files selected for processing (2)
  • web/core/components/core/image-picker-popover.tsx (3 hunks)
  • web/core/components/core/modals/user-image-upload-modal.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • web/core/components/core/image-picker-popover.tsx
  • web/core/components/core/modals/user-image-upload-modal.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Jimmycutie Jimmycutie self-assigned this Sep 18, 2024
@Jimmycutie Jimmycutie added 🌐frontend 🌐web Issues related to our web product 🧹chore labels Sep 18, 2024
@Jimmycutie Jimmycutie added this to the v0.23-dev milestone Sep 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aec4162 and 244fb8a.

Files selected for processing (3)
  • web/core/components/core/image-picker-popover.tsx (2 hunks)
  • web/core/components/core/modals/user-image-upload-modal.tsx (2 hunks)
  • web/core/components/core/modals/workspace-image-upload-modal.tsx (3 hunks)
Additional comments not posted (6)
web/core/components/core/modals/user-image-upload-modal.tsx (2)

42-43: Verify the impact on user experience and documentation.

The changes to the accept property in the useDropzone configuration align with the PR objective to limit the allowed image upload types. Removing support for ".svg" and ".webp" formats is consistent with the issue tracked under WEB-2393.

Please ensure that:

  1. The impact on user experience, especially for users who previously uploaded ".svg" or ".webp" images, is considered and addressed if necessary.
  2. Any user-facing documentation or guides that mention the supported image formats are updated to reflect this change.

160-160: LGTM!

The updated user-facing text accurately informs users about the supported image formats (".jpeg", ".jpg", and ".png"). This change is consistent with the modifications made to the accept property in the useDropzone configuration and ensures that the displayed information aligns with the new restrictions on file uploads.

web/core/components/core/modals/workspace-image-upload-modal.tsx (2)

154-154: LGTM!

The reformatting of the input element's props improves code consistency and readability without affecting functionality.


166-166: LGTM!

Updating the user interface text to reflect the new file format restrictions maintains consistency and sets the right expectations for users.

web/core/components/core/image-picker-popover.tsx (2)

92-93: LGTM!

The changes to the useDropzone configuration correctly restrict the accepted image formats to JPEG and PNG only, aligning with the PR objective.


359-359: LGTM!

The user-facing text has been appropriately updated to list only the supported file formats of .jpeg, .jpg, and .png, providing clarity to the users.

Comment on lines +46 to +47
"image/jpeg": [],
"image/png": [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Inconsistency found in WEBP support across components

The change to restrict image uploads to JPEG and PNG formats in workspace-image-upload-modal.tsx is inconsistent with the file validation logic in other parts of the codebase. Specifically:

  • In packages/editor/src/core/plugins/image/utils/validate-file.ts, WEBP is still listed as an allowed file type.

To ensure consistency and prevent potential bugs:

  • Update validate-file.ts to remove WEBP from the list of allowed types.
  • Review other components that handle image uploads or processing to ensure they align with the new JPEG and PNG only restriction.
  • Consider updating user-facing documentation to reflect the change in supported image formats.
Analysis chain

Verify the impact of restricting image upload formats.

The change to limit the accept property to only "image/jpeg" and "image/png" aligns with the PR objective. However, please consider the following:

  • Ensure that removing support for other image formats like SVG and WEBP does not break any existing functionality in the codebase.
  • Consider updating the user-facing documentation or in-app messaging to clearly communicate the new file format restrictions to users.

Run the following script to verify references to other image formats in the codebase:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify references to image formats other than JPEG and PNG.

# Test: Search for references to SVG. Expect: No results.
rg --type typescript $'image/svg'

# Test: Search for references to WEBP. Expect: No results.
rg --type typescript $'image/webp'

Length of output: 136


Script:

#!/bin/bash
# Description: Verify references to image formats other than JPEG and PNG in TypeScript files.

# Search for references to SVG and WEBP in .ts and .tsx files
rg -i -C 2 -g '*.{ts,tsx}' 'image/(svg|webp)'

Length of output: 1334

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹chore 🌐frontend 🌐web Issues related to our web product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants