fix: prevent block of users in delete all

This commit is contained in:
0x330a 2023-05-15 11:44:11 +10:00
parent 8f51304ec1
commit 9646ea580f
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
2 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
adapter.glide = glide adapter.glide = glide
binding.recyclerView.adapter = adapter binding.recyclerView.adapter = adapter
binding.clearAllMessageRequestsButton.setOnClickListener { deleteAllAndBlock() } binding.clearAllMessageRequestsButton.setOnClickListener { deleteAll() }
} }
override fun onResume() { override fun onResume() {
@ -113,11 +113,11 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
binding.clearAllMessageRequestsButton.isVisible = threadCount != 0 binding.clearAllMessageRequestsButton.isVisible = threadCount != 0
} }
private fun deleteAllAndBlock() { private fun deleteAll() {
val dialog = AlertDialog.Builder(this) val dialog = AlertDialog.Builder(this)
dialog.setMessage(resources.getString(R.string.message_requests_clear_all_message)) dialog.setMessage(resources.getString(R.string.message_requests_clear_all_message))
dialog.setPositiveButton(R.string.yes) { _, _ -> dialog.setPositiveButton(R.string.yes) { _, _ ->
viewModel.clearAllMessageRequests(true) viewModel.clearAllMessageRequests(false)
LoaderManager.getInstance(this).restartLoader(0, null, this) LoaderManager.getInstance(this).restartLoader(0, null, this)
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(this@MessageRequestsActivity) ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(this@MessageRequestsActivity)

View File

@ -270,7 +270,7 @@ class DefaultConversationRepository @Inject constructor(
while (reader.next != null) { while (reader.next != null) {
deleteMessageRequest(reader.current) deleteMessageRequest(reader.current)
val recipient = reader.current.recipient val recipient = reader.current.recipient
if (block && !recipient.isOpenGroupInboxRecipient) { if (block) {
setBlocked(recipient, true) setBlocked(recipient, true)
} }
} }