diff --git a/CHANGELOG.md b/CHANGELOG.md index e13735bc393..dc1805ed637 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ - Bugfix: Fixed lookahead/-behind not working in _Ignores_. (#4965) - Bugfix: Fixed Image Uploader accidentally deleting images with some hosts when link resolver was enabled. (#4971) - Bugfix: Fixed rare crash with Image Uploader when closing a split right after starting an upload. (#4971) +- Bugfix: Fixed an issue on macOS where the image uploader would keep prompting the user even after they clicked "Yes, don't ask again". (#5011) - Bugfix: Hide the Usercard button in the User Info Popup when in special channels. (#4972) - Bugfix: Fixed support for Windows 11 Snap layouts. (#4994) - Bugfix: Fixed some windows appearing between screens. (#4797) diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 90ab8bd4653..656aa18e4a5 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -381,7 +381,9 @@ Split::Split(QWidget *parent) std::ignore = this->input_->ui_.textEdit->imagePasted.connect( [this](const QMimeData *source) { if (!getSettings()->imageUploaderEnabled) + { return; + } if (getSettings()->askOnImageUpload.getValue()) { @@ -392,20 +394,36 @@ Split::Split(QWidget *parent) "You are uploading an image to a 3rd party service not in " "control of the Chatterino team. You may not be able to " "remove the image from the site. Are you okay with this?"); - msgBox.addButton(QMessageBox::Cancel); - msgBox.addButton(QMessageBox::Yes); - msgBox.addButton("Yes, don't ask again", QMessageBox::YesRole); + auto *cancel = msgBox.addButton(QMessageBox::Cancel); + auto *yes = msgBox.addButton(QMessageBox::Yes); + auto *yesDontAskAgain = msgBox.addButton("Yes, don't ask again", + QMessageBox::YesRole); msgBox.setDefaultButton(QMessageBox::Yes); - auto picked = msgBox.exec(); - if (picked == QMessageBox::Cancel) + msgBox.exec(); + + auto *clickedButton = msgBox.clickedButton(); + if (clickedButton == yesDontAskAgain) + { + getSettings()->askOnImageUpload.setValue(false); + } + else if (clickedButton == yes) { + // Continue with image upload + } + else if (clickedButton == cancel) + { + // Not continuing with image upload return; } - else if (picked == 0) // don't ask again button + else { - getSettings()->askOnImageUpload.setValue(false); + // An unknown "button" was pressed - handle it as if cancel was pressed + // cancel is already handled as the "escape" option, so this should never happen + qCWarning(chatterinoImageuploader) + << "Unhandled button pressed:" << clickedButton; + return; } } QPointer edit = this->input_->ui_.textEdit;