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());
} else {
_photo = nullptr;
if (_peer->userpicPhotoUnknown() || (photo && !photo->date)) {
if (_peer->userpicPhotoUnknown() || (photo && photo->isNull())) {
_peer->session().api().requestFullPeer(_peer);
}
}

View File

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

View File

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