Fix partial value saving in passport.

This commit is contained in:
John Preston 2018-04-10 23:34:43 +04:00
parent ccb57a6d69
commit 9142313a6b
3 changed files with 13 additions and 10 deletions

View File

@ -798,12 +798,16 @@ void FormController::saveValueEdit(
const auto nonconst = findValue(value);
if (!editValueChanged(nonconst, data)) {
base::take(nonconst->filesInEdit);
base::take(nonconst->selfieInEdit);
base::take(nonconst->data.encryptedSecretInEdit);
base::take(nonconst->data.hashInEdit);
base::take(nonconst->data.parsedInEdit);
_valueSaveFinished.fire_copy(nonconst);
nonconst->saveRequestId = -1;
crl::on_main(this, [=] {
base::take(nonconst->filesInEdit);
base::take(nonconst->selfieInEdit);
base::take(nonconst->data.encryptedSecretInEdit);
base::take(nonconst->data.hashInEdit);
base::take(nonconst->data.parsedInEdit);
nonconst->saveRequestId = 0;
_valueSaveFinished.fire_copy(nonconst);
});
return;
}
nonconst->data.parsedInEdit = std::move(data);

View File

@ -542,13 +542,11 @@ void PanelController::requestScopeFilesType(int index) {
Expects(index >= 0 && index < _scopes.size());
const auto type = _scopes[index].type;
const auto box = std::make_shared<QPointer<BoxContent>>();
*box = [&] {
_scopeFilesTypeBox = [&] {
if (type == Scope::Type::Identity) {
return show(RequestIdentityType(
[=](int filesIndex) {
editWithUpload(index, filesIndex);
(*box)->closeBox();
},
ranges::view::all(
_scopes[index].files
@ -570,7 +568,6 @@ void PanelController::requestScopeFilesType(int index) {
return show(RequestAddressType(
[=](int filesIndex) {
editWithUpload(index, filesIndex);
(*box)->closeBox();
},
ranges::view::all(
_scopes[index].files
@ -602,6 +599,7 @@ void PanelController::editWithUpload(int index, int filesIndex) {
EditScans::ChooseScan(
base::lambda_guarded(_panel.get(),
[=](QByteArray &&content) {
base::take(_scopeFilesTypeBox);
editScope(index, filesIndex);
uploadScan(std::move(content));
}));

View File

@ -111,6 +111,7 @@ private:
BoxPointer _confirmForgetChangesBox;
Scope *_editScope = nullptr;
int _editScopeFilesIndex = -1;
BoxPointer _scopeFilesTypeBox;
std::map<not_null<const Value*>, BoxPointer> _verificationBoxes;
rpl::lifetime _lifetime;