diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index 5832cb0d70..7cb1f81711 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -765,15 +765,19 @@ void PanelController::editScope(int index, int documentIndex) { case Scope::Type::Email: { const auto &parsed = _editValue->data.parsedInEdit; const auto valueIt = parsed.fields.find("value"); + const auto value = (valueIt == end(parsed.fields) + ? QString() + : valueIt->second); + const auto existing = getDefaultContactValue(_editScope->type); _panelHasUnsavedChanges = nullptr; return object_ptr( _panel.get(), this, GetContactScheme(_editScope->type), - (valueIt == end(parsed.fields) - ? QString() - : valueIt->second), - getDefaultContactValue(_editScope->type)); + value, + (existing.toLower().trimmed() != value.toLower().trimmed() + ? existing + : QString())); } break; } Unexpected("Type in PanelController::editScope()."); diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp index 08bec14d2d..c0006b8c29 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp @@ -270,6 +270,18 @@ void PanelEditContact::setupControls( st::passportFormLabel), st::passportFormLabelPadding)); + if (auto text = _controller->deleteValueLabel()) { + _content->add( + object_ptr( + _content, + std::move(*text) | Info::Profile::ToUpperValue(), + st::passportDeleteButton), + st::passportUploadButtonPadding + )->addClickHandler([=] { + _controller->deleteValue(); + }); + } + const auto submit = [=] { crl::on_main(this, [=] { save(); diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp index c2bf3422b3..6df4934924 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp @@ -329,13 +329,13 @@ not_null PanelEditDocument::setupContent( inner->add( object_ptr(inner, st::passportDetailsSkip)); if (auto text = _controller->deleteValueLabel()) { - _delete = inner->add( + inner->add( object_ptr( inner, std::move(*text) | Info::Profile::ToUpperValue(), st::passportDeleteButton), - st::passportUploadButtonPadding); - _delete->addClickHandler([=] { + st::passportUploadButtonPadding + )->addClickHandler([=] { _controller->deleteValue(); }); }