Use Photo/DocumentData::isNull instead of date check.

This commit is contained in:
John Preston 2021-11-18 11:40:15 +04:00
parent 53c15ed2ac
commit ebded1b421
3 changed files with 7 additions and 7 deletions

View File

@ -137,7 +137,7 @@ void Userpic::processPhoto() {
_photo->wanted(Data::PhotoSize::Thumbnail, _peer->userpicPhotoOrigin()); _photo->wanted(Data::PhotoSize::Thumbnail, _peer->userpicPhotoOrigin());
} else { } else {
_photo = nullptr; _photo = nullptr;
if (_peer->userpicPhotoUnknown() || (photo && !photo->date)) { if (_peer->userpicPhotoUnknown() || (photo && photo->isNull())) {
_peer->session().api().requestFullPeer(_peer); _peer->session().api().requestFullPeer(_peer);
} }
} }

View File

@ -206,7 +206,7 @@ void ResolveDocument(
Window::SessionController *controller, Window::SessionController *controller,
not_null<DocumentData*> document, not_null<DocumentData*> document,
HistoryItem *item) { HistoryItem *item) {
if (!document->date) { if (document->isNull()) {
return; return;
} }
const auto msgId = item ? item->fullId() : FullMsgId(); const auto msgId = item ? item->fullId() : FullMsgId();

View File

@ -63,7 +63,7 @@ void DocumentSaveClickHandler::Save(
Data::FileOrigin origin, Data::FileOrigin origin,
not_null<DocumentData*> data, not_null<DocumentData*> data,
Mode mode) { Mode mode) {
if (!data->date) { if (data->isNull()) {
return; return;
} }
@ -107,7 +107,7 @@ DocumentCancelClickHandler::DocumentCancelClickHandler(
void DocumentCancelClickHandler::onClickImpl() const { void DocumentCancelClickHandler::onClickImpl() const {
const auto data = document(); const auto data = document();
if (!data->date) { if (data->isNull()) {
return; return;
} else if (data->uploading() && _handler) { } else if (data->uploading() && _handler) {
_handler(context()); _handler(context());
@ -119,7 +119,7 @@ void DocumentCancelClickHandler::onClickImpl() const {
void DocumentOpenWithClickHandler::Open( void DocumentOpenWithClickHandler::Open(
Data::FileOrigin origin, Data::FileOrigin origin,
not_null<DocumentData*> data) { not_null<DocumentData*> data) {
if (!data->date) { if (data->isNull()) {
return; return;
} }
@ -171,7 +171,7 @@ void PhotoOpenClickHandler::onClickImpl() const {
void PhotoSaveClickHandler::onClickImpl() const { void PhotoSaveClickHandler::onClickImpl() const {
const auto data = photo(); const auto data = photo();
if (!data->date) { if (data->isNull()) {
return; return;
} else { } else {
data->clearFailed(Data::PhotoSize::Large); data->clearFailed(Data::PhotoSize::Large);
@ -189,7 +189,7 @@ PhotoCancelClickHandler::PhotoCancelClickHandler(
void PhotoCancelClickHandler::onClickImpl() const { void PhotoCancelClickHandler::onClickImpl() const {
const auto data = photo(); const auto data = photo();
if (!data->date) { if (data->isNull()) {
return; return;
} else if (data->uploading() && _handler) { } else if (data->uploading() && _handler) {
_handler(context()); _handler(context());