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

Allow any number of pasted images as attachments. #2681

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from

Commits on Feb 17, 2023

  1. Dedupe attachments by file name, but allow any number of pasted images.

    Previously, the code simply deduped attachments on file name, using the
    internal name `image.png` for any pasted image. This effectively made it
    possible to paste only a single image into a message.
    
    Now, we ignore files called `image.png` when deduping.
    
    Deduping on file name is flawed anyway, because:
    
    1. It's trivial to post multiple identical attachments, so long as each
       of them has a different file name.
    
    2. It's **not** possible to post different attachments if they happen to
       have the same base file name (i.e. after the directory component is
       removed).
    
    So, we're actually getting both false positives and false negatives
    here.
    
    Fixes oxen-io#2345, but introduces a new problem:
    
    When deleting a pasted attachment from a list of such attachments prior
    to sending, **all** pasted attachments are removed, presumably due to
    their all having the same internal file name.
    
    It may be better not to dedupe attachments at all, rather than use the
    crude mechanism of the file name. In that case, the following code would
    suffice:
    
    ```
    -    const uniqAttachments = _.uniqBy(allAttachments, m => m.fileName);
    
    -    state.stagedAttachments[conversationKey] = uniqAttachments;
    +    state.stagedAttachments[conversationKey] = allAttachments;
    ```
    ianmacd committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    34a8c1a View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2023

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