Skip to content

Commit b4a4031

Browse files
[SES-3869] - Fix community blind request issues (#1526)
* Fixed block community request not updated * Fixed name missing after community blind request is accepted
1 parent dc7819b commit b4a4031

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

app/src/main/java/org/session/libsession/messaging/messages/ProfileUpdateHandler.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ class ProfileUpdateHandler @Inject constructor(
123123
profilePic = updates.pic ?: r.profilePic,
124124
blocksCommunityMessagesRequests = updates.blocksCommunityMessageRequests ?: r.blocksCommunityMessagesRequests
125125
)
126+
} else if (updates.blocksCommunityMessageRequests != null &&
127+
r.blocksCommunityMessagesRequests != updates.blocksCommunityMessageRequests) {
128+
r.copy(blocksCommunityMessagesRequests = updates.blocksCommunityMessageRequests)
126129
} else {
127130
r
128131
}

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ class MessageRequestResponseHandler @Inject constructor(
6060
!messageSender.isSelf && messageReceiver.isSelf -> {
6161
// We received a request response from another user.
6262

63+
// Mark the sender as "approvedMe".
64+
// This process MUST be done before trying to update the profile,
65+
// as profile updating requires the contact to exist
66+
val didApproveMe = configFactory.withMutableUserConfigs { configs ->
67+
configs.contacts.upsertContact(messageSender.address) {
68+
val oldApproveMe = approvedMe
69+
approvedMe = true
70+
oldApproveMe
71+
}
72+
}
73+
74+
6375
// Process the profile update if any
6476
message.profile?.toUpdates()?.let { updates ->
6577
profileUpdateHandler.get().handleProfileUpdate(
@@ -69,14 +81,6 @@ class MessageRequestResponseHandler @Inject constructor(
6981
)
7082
}
7183

72-
// Mark the sender as "approvedMe"
73-
val didApproveMe = configFactory.withMutableUserConfigs { configs ->
74-
configs.contacts.upsertContact(messageSender.address) {
75-
val oldApproveMe = approvedMe
76-
approvedMe = true
77-
oldApproveMe
78-
}
79-
}
8084

8185
val threadId by lazy {
8286
threadDatabase.getOrCreateThreadIdFor(messageSender.address)

0 commit comments

Comments
 (0)