Chat list: Don't cache user information (wasn't set properly anyway)
This commit is contained in:
parent
fe4d3c79d7
commit
af4a1f3a69
2 changed files with 7 additions and 6 deletions
|
@ -96,7 +96,7 @@ public:
|
||||||
TDLibWrapper::ChatType chatType;
|
TDLibWrapper::ChatType chatType;
|
||||||
TDLibWrapper::ChatMemberStatus memberStatus;
|
TDLibWrapper::ChatMemberStatus memberStatus;
|
||||||
TDLibWrapper::SecretChatState secretChatState;
|
TDLibWrapper::SecretChatState secretChatState;
|
||||||
QVariantMap userInformation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatListModel::ChatData::ChatData(TDLibWrapper *tdLibWrapper, const QVariantMap &data) :
|
ChatListModel::ChatData::ChatData(TDLibWrapper *tdLibWrapper, const QVariantMap &data) :
|
||||||
|
@ -107,8 +107,7 @@ ChatListModel::ChatData::ChatData(TDLibWrapper *tdLibWrapper, const QVariantMap
|
||||||
groupId(0),
|
groupId(0),
|
||||||
verified(false),
|
verified(false),
|
||||||
memberStatus(TDLibWrapper::ChatMemberStatusUnknown),
|
memberStatus(TDLibWrapper::ChatMemberStatusUnknown),
|
||||||
secretChatState(TDLibWrapper::SecretChatStateUnknown),
|
secretChatState(TDLibWrapper::SecretChatStateUnknown)
|
||||||
userInformation(tdLibWrapper->getUserInformation())
|
|
||||||
{
|
{
|
||||||
const QVariantMap type(data.value(TYPE).toMap());
|
const QVariantMap type(data.value(TYPE).toMap());
|
||||||
switch (chatType = TDLibWrapper::chatTypeFromString(type.value(_TYPE).toString())) {
|
switch (chatType = TDLibWrapper::chatTypeFromString(type.value(_TYPE).toString())) {
|
||||||
|
@ -192,13 +191,15 @@ qlonglong ChatListModel::ChatData::senderMessageDate() const
|
||||||
|
|
||||||
QString ChatListModel::ChatData::senderMessageText() 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
|
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 "";
|
return "";
|
||||||
}
|
}
|
||||||
if (lastMessage(ID) == chatData.value(LAST_READ_OUTBOX_MESSAGE_ID)) {
|
if (lastMessage(ID) == chatData.value(LAST_READ_OUTBOX_MESSAGE_ID)) {
|
||||||
|
|
|
@ -860,7 +860,7 @@
|
||||||
<message>
|
<message>
|
||||||
<source>sent a video note</source>
|
<source>sent a video note</source>
|
||||||
<translation>poslal video-poznámku</translation>
|
<translation>poslal video-poznámku</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ImagePage</name>
|
<name>ImagePage</name>
|
||||||
|
|
Loading…
Reference in a new issue