mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
fix: crash on context menu
This commit is contained in:
parent
acb335ea2b
commit
ea8f08269e
2 changed files with 19 additions and 17 deletions
|
@ -68,11 +68,11 @@ namespace AyuSync {
|
|||
}
|
||||
|
||||
void ayu_sync_controller::invokeHandler(json p) {
|
||||
DEBUG_LOG(("Invoking handler on %1").arg(p.dump().c_str()));
|
||||
LOG(("Invoking handler on %1").arg(p.dump().c_str()));
|
||||
|
||||
auto userId = p["userId"].get<long>();
|
||||
auto type = p["type"].get<std::string>();
|
||||
|
||||
DEBUG_LOG(("userId: %1, type: %1").arg(userId).arg(type.c_str()));
|
||||
LOG(("userId: %1, type: %1").arg(userId).arg(type.c_str()));
|
||||
}
|
||||
}
|
|
@ -1079,23 +1079,25 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
|||
}
|
||||
}
|
||||
|
||||
if (AyuDatabase::editedMessagesTableExists() && !((AyuDatabase::getEditedMessages(item)).empty())) {
|
||||
result->addAction(QString("History"), [=] {
|
||||
auto box = Box<AyuUi::MessageHistoryBox>(item);
|
||||
Ui::show(std::move(box));
|
||||
}, &st::menuIconInfo);
|
||||
if (item != nullptr) {
|
||||
if (AyuDatabase::editedMessagesTableExists() && !((AyuDatabase::getEditedMessages(item)).empty())) {
|
||||
result->addAction(QString("History"), [=] {
|
||||
auto box = Box<AyuUi::MessageHistoryBox>(item);
|
||||
Ui::show(std::move(box));
|
||||
}, &st::menuIconInfo);
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto history = item->history();
|
||||
result->addAction(QString("Hide"), [=]() {
|
||||
const auto initKeepDeleted = settings->keepDeletedMessages;
|
||||
|
||||
settings->set_keepDeletedMessages(false);
|
||||
history->destroyMessage(item);
|
||||
settings->set_keepDeletedMessages(initKeepDeleted);
|
||||
}, &st::menuIconClear);
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto history = item->history();
|
||||
result->addAction(QString("Hide"), [=]() {
|
||||
const auto initKeepDeleted = settings->keepDeletedMessages;
|
||||
|
||||
settings->set_keepDeletedMessages(false);
|
||||
history->destroyMessage(item);
|
||||
settings->set_keepDeletedMessages(initKeepDeleted);
|
||||
}, &st::menuIconClear);
|
||||
|
||||
if (!view || !list->hasCopyRestriction(view->data())) {
|
||||
AddCopyLinkAction(result, link);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue