Fix sending albums in slowmode groups.

Fixes #9106.
This commit is contained in:
John Preston 2020-11-19 15:37:23 +03:00
parent 00504b61cd
commit 639e6d8e28
2 changed files with 6 additions and 5 deletions

View file

@ -280,8 +280,9 @@ void SendFilesBox::enqueueNextPrepare() {
}
while (!_list.filesToProcess.empty()
&& _list.filesToProcess.front().information) {
addFile(std::move(_list.filesToProcess.front()));
auto file = std::move(_list.filesToProcess.front());
_list.filesToProcess.pop_front();
addFile(std::move(file));
}
if (_list.filesToProcess.empty()) {
return;
@ -638,9 +639,6 @@ void SendFilesBox::setupSendWayControls() {
}
void SendFilesBox::updateSendWayControlsVisibility() {
if (_sendLimit == SendLimit::One) {
return;
}
const auto onlyOne = (_sendLimit == SendLimit::One);
_groupFiles->setVisible(_list.hasGroupOption(onlyOne));
_sendImagesAsPhotos->setVisible(
@ -817,10 +815,13 @@ void SendFilesBox::addPreparedAsyncFile(Ui::PreparedFile &&file) {
}
void SendFilesBox::addFile(Ui::PreparedFile &&file) {
// canBeSentInSlowmode checks for non empty filesToProcess.
auto saved = base::take(_list.filesToProcess);
_list.files.push_back(std::move(file));
if (_sendLimit == SendLimit::One && !_list.canBeSentInSlowmode()) {
_list.files.pop_back();
}
_list.filesToProcess = std::move(saved);
}
void SendFilesBox::refreshTitleText() {

View file

@ -63,7 +63,7 @@ private:
Fn<void()> _error;
struct Private;
std::unique_ptr<Private> d;
const std::unique_ptr<Private> d;
base::Timer _timer;
QByteArray _captured;