Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed "Yes, don't ask again" image uploader prompt not working on macOS #5011

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 25 additions & 7 deletions src/widgets/splits/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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<ResizingTextEdit> edit = this->input_->ui_.textEdit;
Expand Down
Loading