File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -734,7 +734,10 @@ export const MessageInput = <
734734 }
735735 }
736736
737- if ( image . state === FileState . UPLOADED ) {
737+ if (
738+ image . state === FileState . UPLOADED ||
739+ image . state === FileState . FINISHED
740+ ) {
738741 attachments . push ( {
739742 fallback : image . file . name ,
740743 image_url : image . url ,
@@ -752,7 +755,10 @@ export const MessageInput = <
752755 sending . current = false ;
753756 return ;
754757 }
755- if ( file . state === FileState . UPLOADED ) {
758+ if (
759+ file . state === FileState . UPLOADED ||
760+ file . state === FileState . FINISHED
761+ ) {
756762 attachments . push ( {
757763 asset_url : file . url ,
758764 file_size : file . file . size ,
@@ -779,10 +785,17 @@ export const MessageInput = <
779785
780786 // TODO: Remove this line and show an error when submit fails
781787 clearEditingState ( ) ;
782-
783788 const updateMessagePromise = editMessage ( updatedMessage ) . then (
784789 clearEditingState ,
785790 ) ;
791+ setFileUploads ( [ ] ) ;
792+ setImageUploads ( [ ] ) ;
793+ setMentionedUsers ( [ ] ) ;
794+ setNumberOfUploads (
795+ ( prevNumberOfUploads ) =>
796+ prevNumberOfUploads - ( attachments ?. length || 0 ) ,
797+ ) ;
798+ setText ( '' ) ;
786799 logChatPromiseExecution ( updateMessagePromise , 'update message' ) ;
787800
788801 sending . current = false ;
Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ export const emojiData = [
5353] ;
5454
5555export const FileState = Object . freeze ( {
56+ // finished and uploaded state are the same thing. First is set on frontend,
57+ // while later is set on backend side
58+ // TODO: Unify both of them
59+ FINISHED : 'finished' ,
5660 NO_FILE : 'no_file' ,
5761 UPLOAD_FAILED : 'upload_failed' ,
5862 UPLOADED : 'uploaded' ,
You can’t perform that action at this time.
0 commit comments