mirror of https://github.com/procxx/kepka.git
Fixed item updating when upload editing media.
This commit is contained in:
parent
1ed83cf193
commit
f24ce584db
|
@ -122,6 +122,10 @@ public:
|
||||||
bool hasUnreadMediaFlag() const;
|
bool hasUnreadMediaFlag() const;
|
||||||
void markMediaRead();
|
void markMediaRead();
|
||||||
|
|
||||||
|
void setIsEditingMedia(bool edit) {
|
||||||
|
_isEditingMedia = edit;
|
||||||
|
}
|
||||||
|
|
||||||
// Zero result means this message is not self-destructing right now.
|
// Zero result means this message is not self-destructing right now.
|
||||||
virtual crl::time getSelfDestructIn(crl::time now) {
|
virtual crl::time getSelfDestructIn(crl::time now) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -310,6 +314,7 @@ protected:
|
||||||
int _textWidth = -1;
|
int _textWidth = -1;
|
||||||
int _textHeight = 0;
|
int _textHeight = 0;
|
||||||
|
|
||||||
|
bool _isEditingMedia = false;
|
||||||
std::unique_ptr<Data::Media> _media;
|
std::unique_ptr<Data::Media> _media;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -942,9 +942,11 @@ void HistoryMessage::updateSentMedia(const MTPMessageMedia *media) {
|
||||||
}
|
}
|
||||||
_flags &= ~MTPDmessage_ClientFlag::f_from_inline_bot;
|
_flags &= ~MTPDmessage_ClientFlag::f_from_inline_bot;
|
||||||
} else {
|
} else {
|
||||||
if (!media || !_media || !_media->updateSentMedia(*media)) {
|
const auto shouldUpdate = _isEditingMedia ? true : !_media->updateSentMedia(*media);
|
||||||
|
if (!media || !_media || shouldUpdate) {
|
||||||
refreshSentMedia(media);
|
refreshSentMedia(media);
|
||||||
}
|
}
|
||||||
|
_isEditingMedia = false;
|
||||||
}
|
}
|
||||||
history()->owner().requestItemResize(this);
|
history()->owner().requestItemResize(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4290,6 +4290,11 @@ void HistoryWidget::sendFileConfirmed(
|
||||||
const auto messageType = isEditing
|
const auto messageType = isEditing
|
||||||
? NewMessageExisting
|
? NewMessageExisting
|
||||||
: NewMessageUnread;
|
: NewMessageUnread;
|
||||||
|
if (isEditing) {
|
||||||
|
if (const auto itemToEdit = App::histItemById(newId)) {
|
||||||
|
itemToEdit->setIsEditingMedia(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (file->type == SendMediaType::Photo) {
|
if (file->type == SendMediaType::Photo) {
|
||||||
auto photoFlags = MTPDmessageMediaPhoto::Flag::f_photo | 0;
|
auto photoFlags = MTPDmessageMediaPhoto::Flag::f_photo | 0;
|
||||||
auto photo = MTP_messageMediaPhoto(
|
auto photo = MTP_messageMediaPhoto(
|
||||||
|
|
Loading…
Reference in New Issue