1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-04 07:35:26 +02:00

fix: get last selfmessage Id

Change-Id: Ibd901be120c061d7b726f657a5d51636716acdcc
This commit is contained in:
Aline Gondim Santos 2022-12-29 10:53:13 -03:00
parent 10b2a5fffa
commit b0ad6c484e
4 changed files with 10 additions and 8 deletions

View file

@ -1507,7 +1507,7 @@ ConversationModel::clearInteractionFromConversation(const QString& convId,
lastInteractionUpdated = true; lastInteractionUpdated = true;
} }
if (conversation.lastSelfMessageId == interactionId) { if (conversation.lastSelfMessageId == interactionId) {
conversation.lastSelfMessageId = conversation.interactions->lastSelfMessageId(); conversation.lastSelfMessageId = conversation.interactions->lastSelfMessageId(owner.profileInfo.uri);
} }
} catch (const std::out_of_range& e) { } catch (const std::out_of_range& e) {
@ -2488,7 +2488,8 @@ ConversationModelPimpl::slotConversationLoaded(uint32_t requestId,
} }
conversation.lastMessageUid = conversation.interactions->lastMessageUid(); conversation.lastMessageUid = conversation.interactions->lastMessageUid();
conversation.lastSelfMessageId = conversation.interactions->lastSelfMessageId(); conversation.lastSelfMessageId = conversation.interactions->lastSelfMessageId(
linked.owner.profileInfo.uri);
if (conversation.lastMessageUid.isEmpty() && !conversation.allMessagesLoaded if (conversation.lastMessageUid.isEmpty() && !conversation.allMessagesLoaded
&& messages.size() != 0) { && messages.size() != 0) {
if (conversation.interactions->size() > 0) { if (conversation.interactions->size() > 0) {
@ -2657,7 +2658,8 @@ ConversationModelPimpl::slotMessageReceived(const QString& accountId,
return; return;
} }
conversation.lastMessageUid = conversation.interactions->lastMessageUid(); conversation.lastMessageUid = conversation.interactions->lastMessageUid();
conversation.lastSelfMessageId = conversation.interactions->lastSelfMessageId(); conversation.lastSelfMessageId = conversation.interactions->lastSelfMessageId(
linked.owner.profileInfo.uri);
invalidateModel(); invalidateModel();
if (!interaction::isOutgoing(msg)) { if (!interaction::isOutgoing(msg)) {
Q_EMIT behaviorController.newUnreadInteraction(linked.owner.id, Q_EMIT behaviorController.newUnreadInteraction(linked.owner.id,

View file

@ -722,12 +722,12 @@ MessageListModel::lastMessageUid() const
} }
QString QString
MessageListModel::lastSelfMessageId() const MessageListModel::lastSelfMessageId(const QString& id) const
{ {
for (auto it = interactions_.rbegin(); it != interactions_.rend(); ++it) { for (auto it = interactions_.rbegin(); it != interactions_.rend(); ++it) {
auto lastType = it->second.type; auto lastType = it->second.type;
if (lastType == interaction::Type::TEXT and !it->second.body.isEmpty() if (lastType == interaction::Type::TEXT and !it->second.body.isEmpty()
and it->second.authorUri.isEmpty()) { and (it->second.authorUri.isEmpty() || it->second.authorUri == id)) {
return it->first; return it->first;
} }
} }

View file

@ -142,7 +142,7 @@ public:
void reactToMessage(const QString& msgId, interaction::Info& info); void reactToMessage(const QString& msgId, interaction::Info& info);
QVariantMap convertReactMessagetoQVariant(const QSet<QString>&); QVariantMap convertReactMessagetoQVariant(const QSet<QString>&);
QString lastMessageUid() const; QString lastMessageUid() const;
QString lastSelfMessageId() const; QString lastSelfMessageId(const QString& id) const;
QString findEmojiReaction(const QString& emoji, QString findEmojiReaction(const QString& emoji,
const QString& authorURI, const QString& authorURI,

View file

@ -126,14 +126,14 @@ public Q_SLOTS: // METHODS
QString openVideoInput(const QString& resource) QString openVideoInput(const QString& resource)
{ {
#ifdef ENABLE_VIDEO #ifdef ENABLE_VIDEO
return libjami::openVideoInput(resource.toStdString()).c_str(); return libjami::openVideoInput(resource.toLatin1().toStdString()).c_str();
#endif #endif
} }
void closeVideoInput(const QString& resource) void closeVideoInput(const QString& resource)
{ {
#ifdef ENABLE_VIDEO #ifdef ENABLE_VIDEO
libjami::closeVideoInput(resource.toStdString()); libjami::closeVideoInput(resource.toLatin1().toStdString());
#endif #endif
} }