Skip to content

Commit e390d11

Browse files
Merge pull request #1670 from session-foundation/fix-contact-created-for-groups
Fix contacts being created incorrectly for group chats
2 parents 09050b4 + a872dad commit e390d11

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

app/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,10 @@ class ReceivedMessageHandler @Inject constructor(
414414
runThreadUpdate = runThreadUpdate
415415
) ?: return null
416416

417-
// If we have previously "hidden" the sender, we should flip the flag back to visible
418-
if (senderAddress is Address.Standard && senderAddress.address != userPublicKey) {
417+
// If we have previously "hidden" the sender, we should flip the flag back to visible,
418+
// and this should only be done only for 1:1 messages
419+
if (senderAddress is Address.Standard && senderAddress.address != userPublicKey
420+
&& context.threadAddress is Address.Standard) {
419421
val existingContact =
420422
configFactory.withUserConfigs { it.contacts.get(senderAddress.accountId.hexString) }
421423

app/src/main/java/org/session/libsession/messaging/sending_receiving/VisibleMessageHandler.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,11 @@ class VisibleMessageHandler @Inject constructor(
172172
runThreadUpdate = runThreadUpdate
173173
) ?: return null
174174

175-
// If we have previously "hidden" the sender, we should flip the flag back to visible
176-
if (senderAddress is Address.Standard && senderAddress.address != ctx.currentUserPublicKey) {
175+
// If we have previously "hidden" the sender, we should flip the flag back to visible,
176+
// and this should only be done only for 1:1 messages
177+
if (senderAddress is Address.Standard &&
178+
senderAddress.address != ctx.currentUserPublicKey &&
179+
threadAddress is Address.Standard) {
177180
val existingContact =
178181
configFactory.withUserConfigs { it.contacts.get(senderAddress.accountId.hexString) }
179182

0 commit comments

Comments
 (0)