mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Add block request action button to collapsed join request events.
This commit is contained in:
@@ -1207,7 +1207,7 @@ final class GroupManagerV2 {
|
||||
|
||||
DecryptedGroupChange plainGroupChange = groupMutation.getGroupChange();
|
||||
|
||||
if (plainGroupChange != null && DecryptedGroupUtil.changeIsEmptyExceptForProfileKeyChanges(plainGroupChange)) {
|
||||
if (plainGroupChange != null && DecryptedGroupUtil.changeIsSilent(plainGroupChange)) {
|
||||
if (sendToMembers) {
|
||||
ApplicationDependencies.getJobManager().add(PushGroupSilentUpdateSendJob.create(context, groupId, groupMutation.getNewGroupState(), outgoingMessage));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.thoughtcrime.securesms.groups.v2
|
||||
|
||||
import android.content.Context
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeException
|
||||
import org.thoughtcrime.securesms.groups.GroupId
|
||||
import org.thoughtcrime.securesms.groups.GroupManager
|
||||
import org.thoughtcrime.securesms.groups.ui.GroupChangeFailureReason
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import java.io.IOException
|
||||
|
||||
private val TAG: String = Log.tag(GroupManagementRepository::class.java)
|
||||
|
||||
/**
|
||||
* Single source repository for managing groups.
|
||||
*/
|
||||
class GroupManagementRepository @JvmOverloads constructor(private val context: Context = ApplicationDependencies.getApplication()) {
|
||||
|
||||
fun blockJoinRequests(groupId: GroupId.V2, recipient: Recipient): Single<GroupManagementResult> {
|
||||
return Single.fromCallable {
|
||||
try {
|
||||
GroupManager.ban(context, groupId, recipient.id)
|
||||
GroupManagementResult.Success
|
||||
} catch (e: GroupChangeException) {
|
||||
Log.w(TAG, e)
|
||||
GroupManagementResult.Failure(GroupChangeFailureReason.fromException(e))
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, e)
|
||||
GroupManagementResult.Failure(GroupChangeFailureReason.fromException(e))
|
||||
}
|
||||
}.subscribeOn(Schedulers.io())
|
||||
}
|
||||
|
||||
sealed class GroupManagementResult {
|
||||
object Success : GroupManagementResult()
|
||||
data class Failure(val reason: GroupChangeFailureReason) : GroupManagementResult()
|
||||
}
|
||||
}
|
||||
@@ -612,6 +612,8 @@ public class GroupsV2StateProcessor {
|
||||
for (LocalGroupLogEntry entry : processedLogEntries) {
|
||||
if (entry.getChange() != null && DecryptedGroupUtil.changeIsEmptyExceptForProfileKeyChanges(entry.getChange()) && !DecryptedGroupUtil.changeIsEmpty(entry.getChange())) {
|
||||
Log.d(TAG, "Skipping profile key changes only update message");
|
||||
} if (entry.getChange() != null && DecryptedGroupUtil.changeIsEmptyExceptForBanChangesAndOptionalProfileKeyChanges(entry.getChange())) {
|
||||
Log.d(TAG, "Skipping ban changes only update message");
|
||||
} else {
|
||||
if (entry.getChange() != null && DecryptedGroupUtil.changeIsEmpty(entry.getChange()) && previousGroupState != null) {
|
||||
Log.w(TAG, "Empty group update message seen. Not inserting.");
|
||||
|
||||
Reference in New Issue
Block a user