oxen-io / session-desktop

Session Desktop - Onion routing based messenger
https://getsession.org
GNU General Public License v3.0
1.44k stars 186 forks source link

fix: prevent sending messages with attachments multiple times by adding current state check #3100

Open VityaSchel opened 1 month ago

VityaSchel commented 1 month ago

First time contributor checklist:

Contributor checklist:

Description

I have tested issue described in #2744 and figured out that the problem was in onSendMessage() function taking long time to complete (and thus reset composition box input) because of getFiles() async function which scales and stores attachments locally before sending.

I have added a simple check to CompositionBoxInner class that prevents user from sending multiple messages. I think the best solution would be to move all attachments logic to sending stage so that visually messages would be sent immediately, but I didn't want to change a lot of logic.

Related: #2744

pottsandpans commented 1 month ago

This will be tracked internally on Jira (SES-1939) for code review.