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

New Attachment Upload UX with Real-Time Previews #44889

Merged
merged 27 commits into from
Jul 31, 2024

Commits on Jul 12, 2024

  1. ReportUtils: simplify optimistic comment constructor logic

    - Consolidated the logic for generating `htmlForNewComment` and `textForNewComment`.
    - Cleaned up redundant checks for file and text presence.
    - Optimized creation of the `reportAction` object.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    bf4c208 View commit details
    Browse the repository at this point in the history
  2. ReportUtils: extract attachment HTML generation to a separate function

    - Introduced a new function `getAttachmentHtml` to handle the generation of attachment HTML.
    - Updated `addComment` function to use `getAttachmentHtml` for cleaner code.
    - Ensured `textForNewComment` is parsed from `htmlForNewComment` for consistency.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    ccfa861 View commit details
    Browse the repository at this point in the history
  3. ReportUtils: rename getAttachmentHtml to getUploadingAttachmentHtml

    Renamed the function `getAttachmentHtml` to `getUploadingAttachmentHtml` for better clarity and consistency. The new name more accurately reflects its purpose in generating HTML for uploading attachments.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    c7fdc5a View commit details
    Browse the repository at this point in the history
  4. Enhance attachment handling in getUploadingAttachmentHtml function

    - Improved `getUploadingAttachmentHtml` function to handle image and video attachments.
    - Added conditions to check for MIME types and generate appropriate HTML for image and video sources.
    - Updated `htmlForNewComment` to remove an extra newline character.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    f5fcb32 View commit details
    Browse the repository at this point in the history
  5. fix: prevent error when custom attachment source attribute is undefined

    Added nullish coalescing operator to ensure `attribs[CONST.ATTACHMENT_SOURCE_ATTRIBUTE]` is defined before using `split()`, preventing potential runtime errors.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    605990b View commit details
    Browse the repository at this point in the history
  6. ReportUtils: improve attachment HTML generation logic

    - Return HTML string directly within conditionals for image and video attachments.
    - Ensure a generic message is returned for other file types.
    - Adjust the HTML for new comments to conditionally include line breaks when an attachment is present.
    ```
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    b2b1544 View commit details
    Browse the repository at this point in the history
  7. VideoRenderer: correct video source URL resolution logic

    Refactor the order of URL resolution priorities to fix issues with video rendering. Now, the video source URL will first check the ATTACHMENT_SOURCE_ATTRIBUTE, then 'src', and finally 'href'.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    5d8d376 View commit details
    Browse the repository at this point in the history
  8. ReportUtils: improve attachment handling for non-media files

    Updated the fallback case for handling non-media files in `src/libs/ReportUtils.ts`. Instead of using a generic uploading message, we now present a link to the file for better user experience.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    cce5e7e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    feed1af View commit details
    Browse the repository at this point in the history
  10. ReportUtils: lint fix

    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    75756e5 View commit details
    Browse the repository at this point in the history
  11. ReportUtils: fix type errors

    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    d017246 View commit details
    Browse the repository at this point in the history
  12. CONST: add optimistic source attribute for attachments

    - Introduced `ATTACHMENT_OPTIMISTIC_SOURCE_ATTRIBUTE` in constants.
    - Updated `ReportUtils` to include the new optimistic source attribute in the HTML output for images, videos, and other file types.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    72077d4 View commit details
    Browse the repository at this point in the history
  13. libs/isReportMessageAttachment: improve attachment message check logi…

    …c in .ts 🧩
    
    - Extracted attachment regex pattern into a constant `ATTACHMENT_PATTERN`
    - Simplified the return condition by leveraging the extracted constant
    - Fix function parameter documentation
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    0e34971 View commit details
    Browse the repository at this point in the history
  14. AttachmentCommentFragment: update attachment uploading detection

    Updated the `isUploading` condition to use `html.contains(CONST.ATTACHMENT_OPTIMISTIC_SOURCE_ATTRIBUTE)` instead of comparing it to `CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML`, because `CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML` is being removed
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    556f795 View commit details
    Browse the repository at this point in the history
  15. ContextMenuActions: update attachment detection logic

    Since `CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML` is no longer used it's removed from the check
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    40d07c4 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    b7a0608 View commit details
    Browse the repository at this point in the history
  17. isReportMessageAttachment: Update to pass unit tests

    - The message "Uploading Attachment..." no longer exists - we don't need to test for such text to match an attachment action
    - All attachments use the `CONST.ATTACHMENT_SOURCE_ATTRIBUTE` it can be used to distinct them
      - Attachments in upload use the same attribute as well
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    d28d2e0 View commit details
    Browse the repository at this point in the history
  18. Remove uploading-attachment custom model from BaseHTMLEngineProvider

    The `uploading-attachment` custom model is removed as it is no longer used.
    kidroca committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    27ca9a8 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2024

  1. ReportUtils: Enhance data attribute generation

    - Enhanced data attribute generation by converting to an array and using `Array.prototype.filter` to remove falsy values.
    - Added additional attributes for file width and height.
    kidroca committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    feeb9c4 View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2024

  1. Configuration menu
    Copy the full SHA
    2903070 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. Configuration menu
    Copy the full SHA
    58c4237 View commit details
    Browse the repository at this point in the history
  2. 🐛 fix(AnchorForAttachmentsOnly): update download icon visibility logic

    Modified the condition for displaying the download icon in `BaseAnchorForAttachmentsOnly.tsx`.
    The icon will now only show if the `sourceID` is provided and the application is not offline.
    This change ensures that the download button does not appear while the file is still uploading and lacks a final hosted URL
    kidroca committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    715ae21 View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2024

  1. 🐛 fix(components/AnchorForAttachmentsOnly): add sourceID check to dow…

    …nload logic
    
    Update the download logic to include a check for the presence of
    sourceID alongside existing conditions for isDownloading and
    isOffline, preventing potential errors when attempting to download
    attachments without a valid source ID.
    kidroca committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    4008f07 View commit details
    Browse the repository at this point in the history
  2. ♻️ refactor(components/Attachments): improve attachment file name ext…

    …raction
    
    Update the logic for extracting attachment file names by using the original
    file name attribute if available. This enhances clarity and ensures that
    the most accurate file name is utilized, falling back to the source only
    when necessary.
    kidroca committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    cab7749 View commit details
    Browse the repository at this point in the history
  3. 🐛 fix(components/AttachmentModal): prevent downloading local file sou…

    …rces
    
    Added a check to ensure local file sources (file: or blob:) are not
    included in the download options. This avoids redundancy and potential
    issues with file not found when attempting to download local files.
    kidroca committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    955009b View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2024

  1. 🐛 fix(report/ContextMenu): hide download option for uploading files

    Added a check to ensure the download option is hidden for resources that
    are currently being uploaded. This prevents users from attempting to
    download files that are not yet available, improving the user experience.
    kidroca committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    c147141 View commit details
    Browse the repository at this point in the history
  2. 🐛 fix(libs/ReportUtils): revert translationKey assignment for attachm…

    …ents
    
    Restores original logic to set translationKey only when the comment is an attachment
    kidroca committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    c2c7ec9 View commit details
    Browse the repository at this point in the history