Chat list: Don't cache user information (wasn't set properly anyway)

This commit is contained in:
Sebastian Wolf 2021-01-29 22:53:28 +01:00
parent fe4d3c79d7
commit af4a1f3a69
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
2 changed files with 7 additions and 6 deletions

View file

@ -96,7 +96,7 @@ public:
TDLibWrapper::ChatType chatType;
TDLibWrapper::ChatMemberStatus memberStatus;
TDLibWrapper::SecretChatState secretChatState;
QVariantMap userInformation;
};
ChatListModel::ChatData::ChatData(TDLibWrapper *tdLibWrapper, const QVariantMap &data) :
@ -107,8 +107,7 @@ ChatListModel::ChatData::ChatData(TDLibWrapper *tdLibWrapper, const QVariantMap
groupId(0),
verified(false),
memberStatus(TDLibWrapper::ChatMemberStatusUnknown),
secretChatState(TDLibWrapper::SecretChatStateUnknown),
userInformation(tdLibWrapper->getUserInformation())
secretChatState(TDLibWrapper::SecretChatStateUnknown)
{
const QVariantMap type(data.value(TYPE).toMap());
switch (chatType = TDLibWrapper::chatTypeFromString(type.value(_TYPE).toString())) {
@ -192,13 +191,15 @@ qlonglong ChatListModel::ChatData::senderMessageDate() const
QString ChatListModel::ChatData::senderMessageText() const
{
return FernschreiberUtils::getMessageShortText(tdLibWrapper, lastMessage(CONTENT).toMap(), isChannel(), this->userInformation.value(ID).toLongLong(), lastMessage(SENDER).toMap() );
qlonglong myUserId = tdLibWrapper->getUserInformation().value(ID).toLongLong();
return FernschreiberUtils::getMessageShortText(tdLibWrapper, lastMessage(CONTENT).toMap(), isChannel(), myUserId, lastMessage(SENDER).toMap() );
}
QString ChatListModel::ChatData::senderMessageStatus() const
{
if (isChannel() || this->userInformation.value(ID).toLongLong() != senderUserId() || this->userInformation.value(ID).toLongLong() == chatId) {
qlonglong myUserId = tdLibWrapper->getUserInformation().value(ID).toLongLong();
if (isChannel() || myUserId != senderUserId() || myUserId == chatId) {
return "";
}
if (lastMessage(ID) == chatData.value(LAST_READ_OUTBOX_MESSAGE_ID)) {

View file

@ -860,7 +860,7 @@
<message>
<source>sent a video note</source>
<translation>poslal video-poznámku</translation>
</message>
</message>
</context>
<context>
<name>ImagePage</name>