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