[network/neochat] src/messagecontent: Don't auto-play all downloaded audio messages when uploading a new one

Joshua Goins <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit ab008fb2ddb704750c9de25e3d4ec2396bd4e9c3 by Joshua Goins.
Committed on 03/08/2026 at 20:29.
Pushed by redstrate into branch 'master'.

Don't auto-play all downloaded audio messages when uploading a new one

It now checks if the user actually initiated the download for that
specific component.

CCBUG: 523783

M  +11   -2    src/messagecontent/AudioComponent.qml

https://invent.kde.org/network/neochat/-/commit/ab008fb2ddb704750c9de25e3d4ec2396bd4e9c3

diff --git a/src/messagecontent/AudioComponent.qml b/src/messagecontent/AudioComponent.qml
index 012e3ffb4..7df197807 100644
--- a/src/messagecontent/AudioComponent.qml
+++ b/src/messagecontent/AudioComponent.qml
@@ -32,8 +32,9 @@ ColumnLayout {
      * @brief Whether the media has been downloaded.
      */
     readonly property bool downloaded: block.fileTransferInfo && block.fileTransferInfo.completed
-    onDownloadedChanged:  if (downloaded) {
+    onDownloadedChanged:  if (downloaded && !block.fileTransferInfo.isUpload && userInitiatedDownload) {
         beginPlayback();
+        userInitiatedDownload = false;
     }
 
     /**
@@ -41,6 +42,11 @@ ColumnLayout {
      */
     required property bool editable
 
+    /**
+     * @brief Whether the user has initiated the download by pressing the button.
+     */
+    property bool userInitiatedDownload: false
+
     function beginPlayback(): void {
         audio.source = root.block.fileTransferInfo.localPath;
         MediaManager.startPlayback();
@@ -60,7 +66,10 @@ ColumnLayout {
 
             PropertyChanges {
                 playButton.icon.name: "download"
-                playButton.onClicked: Message.room.downloadFile(root.eventId)
+                playButton.onClicked: {
+                    root.userInitiatedDownload = true;
+                    Message.room.downloadFile(root.eventId);
+                }
             }
         },
         State {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.