mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
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 userId = p["userId"].get<long>();
|
||||||
auto type = p["type"].get<std::string>();
|
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())) {
|
if (item != nullptr) {
|
||||||
result->addAction(QString("History"), [=] {
|
if (AyuDatabase::editedMessagesTableExists() && !((AyuDatabase::getEditedMessages(item)).empty())) {
|
||||||
auto box = Box<AyuUi::MessageHistoryBox>(item);
|
result->addAction(QString("History"), [=] {
|
||||||
Ui::show(std::move(box));
|
auto box = Box<AyuUi::MessageHistoryBox>(item);
|
||||||
}, &st::menuIconInfo);
|
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())) {
|
if (!view || !list->hasCopyRestriction(view->data())) {
|
||||||
AddCopyLinkAction(result, link);
|
AddCopyLinkAction(result, link);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue