Skip to content

Conversation

@nidhal-labidi
Copy link
Contributor

Checklist

Reviewer

  • I've checked out the code and tested it myself.

Changes
By adding this PR we should be able to handle all the possible scenarios based on whether the client and host input fields are set to allow multiple file uploads or just a single file.


Scenarios and Suggested Approaches

  1. Single File Only on Both Client and Host (No multiple Attribute):

    • Scenario: Both client and host input fields are configured to accept only one file (i.e., multiple attribute is not set). If the host already has a file attached and a new file arrives from the client, there’s a choice to either:
      • Overwrite the existing file.
      • Reject the new file since a file is already present.
    • Chosen Approach: Overwrite the existing file.
      • Since only one file can be attached at any given time, overwriting simplifies the process and keeps the input field up-to-date with the latest file received.
  2. Client: Single File Only; Host: Multiple Files Allowed:

    • Scenario: The client’s input field allows only one file, but the host’s input field can accept multiple files (has the multiple attribute). If the host already has files attached and a new file arrives from the client, there’s a choice to either:
      • Append the new file to the host’s existing files.
      • Replace the host’s files with the new file.
    • Chosen Approach: Append the new file.
      • Since the host is allowed to handle multiple files, appending keeps existing files intact, providing greater flexibility.
  3. Multiple Files Allowed on Both Client and Host (multiple Attribute Set for Both):

    • Scenario: Both the client and the host allow multiple files. If the host already has files attached and new files arrive from the client, you can either:
      • Add the new files to the existing ones.
      • Replace all files on the host with the new ones.
    • Chosen Approach: Append the new files.
      • This preserves both the host’s and client’s files without unexpected loss, leveraging the host’s ability to handle multiple files. It also offers flexibility and avoids disrupting existing attachments.
  4. Client: Multiple Files Allowed; Host: Single File Only:

    • Scenario: The client can send multiple files, but the host’s input field can only handle one file. If the host already has a file and multiple files are sent from the client, you can either:
      • Replace the existing file with the last file sent.
      • Reject additional files since the host only allows one.
    • Chosen Approach: Overwrite with the last file received from the client.
      • Given that the host allows only one file, overwriting with the most recent file provides a predictable outcome. If overwriting each time is too disruptive, you could log an alert or notification when files are replaced, but this approach generally keeps it straightforward.

Signed-off-by: nidhal-labidi <nidhal.labidi@compose.us>
Copy link
Contributor

@TamaraBogantseva TamaraBogantseva left a comment

Choose a reason for hiding this comment

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

LGTM! I think it's a right approach

@nidhal-labidi
Copy link
Contributor Author

I'm going to merge it since I think I need it for building the extension.

@nidhal-labidi nidhal-labidi merged commit 69c0695 into main Nov 11, 2024
@nidhal-labidi nidhal-labidi deleted the fix/remove-multiple-attribute-setting branch November 11, 2024 11:08
@TamaraBogantseva TamaraBogantseva mentioned this pull request Nov 15, 2024
4 tasks
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.

Remove automatic multiple attribute setting for inputField

3 participants