Hotfix: Use up-to-date chat information for open-by-notification

This commit is contained in:
Sebastian Wolf 2020-11-20 19:08:05 +01:00
parent 4c1f3f7dfc
commit dd6239c119
4 changed files with 12 additions and 3 deletions

View file

@ -47,7 +47,7 @@ Page {
console.log("[OverviewPage] Opening chat from external call...") console.log("[OverviewPage] Opening chat from external call...")
if (chatListCreated) { if (chatListCreated) {
pageStack.pop(overviewPage, PageStackAction.Immediate) pageStack.pop(overviewPage, PageStackAction.Immediate)
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : tdLibWrapper.getChat(chatId) }, PageStackAction.Immediate) pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : chatListModel.getById(chatId) }, PageStackAction.Immediate)
} }
} }
onPleaseOpenUrl: { onPleaseOpenUrl: {

View file

@ -386,6 +386,14 @@ QVariantMap ChatListModel::get(int row)
return res; return res;
} }
QVariantMap ChatListModel::getById(qlonglong chatId)
{
if (chatIndexMap.contains(chatId)) {
return chatList.value(chatIndexMap.value(chatId))->chatData;
}
return QVariantMap();
}
int ChatListModel::updateChatOrder(int chatIndex) int ChatListModel::updateChatOrder(int chatIndex)
{ {
ChatData *chat = chatList.at(chatIndex); ChatData *chat = chatList.at(chatIndex);

View file

@ -38,6 +38,7 @@ public:
Q_INVOKABLE void redrawModel(); Q_INVOKABLE void redrawModel();
Q_INVOKABLE QVariantMap get(int row); Q_INVOKABLE QVariantMap get(int row);
Q_INVOKABLE QVariantMap getById(qlonglong chatId);
bool showAllChats() const; bool showAllChats() const;
void setShowAllChats(bool showAll); void setShowAllChats(bool showAll);

View file

@ -883,7 +883,7 @@
<name>MessageOverlayFlickable</name> <name>MessageOverlayFlickable</name>
<message> <message>
<source>You</source> <source>You</source>
<translation type="unfinished"></translation> <translation type="unfinished">You</translation>
</message> </message>
<message> <message>
<source>This message was forwarded. Original author: %1</source> <source>This message was forwarded. Original author: %1</source>
@ -947,7 +947,7 @@
<name>PinnedMessageItem</name> <name>PinnedMessageItem</name>
<message> <message>
<source>You</source> <source>You</source>
<translation type="unfinished"></translation> <translation type="unfinished">You</translation>
</message> </message>
<message> <message>
<source>Pinned Message</source> <source>Pinned Message</source>