mirror of https://github.com/procxx/kepka.git
parent
0e7ce97da7
commit
f3102573ea
|
@ -170,16 +170,11 @@ namespace App {
|
|||
peerToChannel(peerId),
|
||||
message.vid.v);
|
||||
if (existing) {
|
||||
auto update = true;
|
||||
if (existing->isLocalUpdateMedia()) {
|
||||
if (checkEntitiesAndViewsUpdate(m.c_message())) {
|
||||
update = false;
|
||||
existing->setIsLocalUpdateMedia(false);
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
existing->applyEdition(message);
|
||||
checkEntitiesAndViewsUpdate(m.c_message());
|
||||
}
|
||||
existing->applyEdition(message);
|
||||
existing->setIsLocalUpdateMedia(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -139,6 +139,9 @@ public:
|
|||
|
||||
// For edit media in history_message.
|
||||
virtual void returnSavedMedia() {};
|
||||
void savePreviousMedia() {
|
||||
_savedMedia = _media->clone(this);
|
||||
}
|
||||
void clearSavedMedia() {
|
||||
_isEditingMedia = false;
|
||||
_savedMedia = nullptr;
|
||||
|
|
|
@ -926,7 +926,9 @@ void HistoryMessage::applyEdition(const MTPDmessage &message) {
|
|||
textWithEntities.entities = TextUtilities::EntitiesFromMTP(message.ventities.v);
|
||||
}
|
||||
setReplyMarkup(message.has_reply_markup() ? (&message.vreply_markup) : nullptr);
|
||||
refreshMedia(message.has_media() ? (&message.vmedia) : nullptr);
|
||||
if (!_isLocalUpdateMedia) {
|
||||
refreshMedia(message.has_media() ? (&message.vmedia) : nullptr);
|
||||
}
|
||||
setViewsCount(message.has_views() ? message.vviews.v : -1);
|
||||
setText(textWithEntities);
|
||||
|
||||
|
|
|
@ -4324,6 +4324,7 @@ void HistoryWidget::sendFileConfirmed(
|
|||
MTP_long(groupId));
|
||||
|
||||
if (itemToEdit) {
|
||||
itemToEdit->savePreviousMedia();
|
||||
itemToEdit->applyEdition(mtpMessage.c_message());
|
||||
} else {
|
||||
history->addNewMessage(mtpMessage, NewMessageUnread);
|
||||
|
@ -4354,6 +4355,7 @@ void HistoryWidget::sendFileConfirmed(
|
|||
MTP_long(groupId));
|
||||
|
||||
if (itemToEdit) {
|
||||
itemToEdit->savePreviousMedia();
|
||||
itemToEdit->applyEdition(mtpMessage.c_message());
|
||||
} else {
|
||||
history->addNewMessage(mtpMessage, NewMessageUnread);
|
||||
|
|
|
@ -843,8 +843,10 @@ void MainWidget::cancelUploadLayer(not_null<HistoryItem*> item) {
|
|||
if (const auto item = App::histItemById(itemId)) {
|
||||
const auto history = item->history();
|
||||
if (!item->isEditingMedia()) {
|
||||
item->destroy();
|
||||
history->requestChatListMessage();
|
||||
if (!IsServerMsgId(itemId.msg)) {
|
||||
item->destroy();
|
||||
history->requestChatListMessage();
|
||||
}
|
||||
} else {
|
||||
item->returnSavedMedia();
|
||||
session().uploader().cancel(item->fullId());
|
||||
|
|
Loading…
Reference in New Issue