gdpelican / babble

Discourse Shoutbox plugin
MIT License
107 stars 63 forks source link

Duplicate images #304

Closed levidurfee closed 3 years ago

levidurfee commented 4 years ago

If I send an image, then try to send a different image, it shows the first image again.

Discourse: 2.6.0.beta1
Babble: 4.2.0

Any help is appreciated. Let me know if any other information would be helpful.

levidurfee commented 4 years ago

I think it has something to do with this error.

cannot call methods on fileupload prior to initialization; attempted to call method 'destroy'

https://github.com/gdpelican/babble/blob/b053da5283f650f52c2b92040998a7f1265187b9/assets/javascripts/discourse/widgets/babble-composer.js.es6#L67

Maybe the below diff might help?

--- a/babble-composer.js.es6    2020-10-21 16:35:26.000000000 -0400
+++ b/babble-composer.js.es6    2020-10-21 16:35:51.000000000 -0400
@@ -64,10 +64,10 @@
     })

     $element.on("fileuploaddone", (e, data) => {
-      $element.fileupload('destroy')
       this.state.submitDisabled = undefined
       let upload = data.result
       if (upload && upload.url) {
+        $element.fileupload('destroy')
         Babble.createPost(this.state.topic, getUploadMarkdown(upload))
       } else {
         // failure :(
levidurfee commented 4 years ago

Also noticed this warning:

Babble composer already active or could not be found

https://github.com/gdpelican/babble/blob/b053da5283f650f52c2b92040998a7f1265187b9/assets/javascripts/discourse/lib/chat-element-utils.js.es6#L73