Fix Getting Member Objects
It seems that there are no guarantees that we will have a room member event available when a message has arrived especially early on after room load so we should create member object unconditionally and make it the responsibility of the caller to only ask for real senders. BUG: 498649
This commit is contained in:
@@ -1729,10 +1729,6 @@ void NeoChatRoom::setRoomState(const QString &type, const QString &stateKey, con
|
||||
|
||||
NeochatRoomMember *NeoChatRoom::qmlSafeMember(const QString &memberId)
|
||||
{
|
||||
if (!isMember(memberId)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!m_memberObjects.contains(memberId)) {
|
||||
return m_memberObjects.emplace(memberId, std::make_unique<NeochatRoomMember>(this, memberId)).first->second.get();
|
||||
}
|
||||
|
||||
@@ -588,6 +588,15 @@ public:
|
||||
*/
|
||||
Quotient::FileTransferInfo cachedFileTransferInfo(const Quotient::RoomEvent *event) const;
|
||||
|
||||
/**
|
||||
* @brief Return a NeochatRoomMember object for the given user ID.
|
||||
*
|
||||
* @warning Because we can't guarantee that a member state event is downloaded
|
||||
* before a message they sent arrives this will create the object unconditionally
|
||||
* assuming that the state event will turn up later. It is therefor the
|
||||
* responsibility of the caller to ensure that they only ask for objects
|
||||
* for real senders.
|
||||
*/
|
||||
NeochatRoomMember *qmlSafeMember(const QString &memberId);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user