mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Add deletion action on voice broadcast event
This commit is contained in:
parent
daf4fc0f6d
commit
e4a52e1d5e
2 changed files with 10 additions and 3 deletions
|
@ -17,6 +17,7 @@
|
|||
package im.vector.app.features.home.room.detail.timeline.action
|
||||
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.features.voicebroadcast.STATE_ROOM_VOICE_BROADCAST_INFO
|
||||
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||
import javax.inject.Inject
|
||||
|
@ -27,8 +28,13 @@ class CheckIfCanRedactEventUseCase @Inject constructor(
|
|||
|
||||
fun execute(event: TimelineEvent, actionPermissions: ActionPermissions): Boolean {
|
||||
// Only some event types are supported for the moment
|
||||
val canRedactEventTypes = listOf(EventType.MESSAGE, EventType.STICKER) +
|
||||
EventType.POLL_START + EventType.STATE_ROOM_BEACON_INFO
|
||||
val canRedactEventTypes: List<String> = listOf(
|
||||
EventType.MESSAGE,
|
||||
EventType.STICKER,
|
||||
STATE_ROOM_VOICE_BROADCAST_INFO,
|
||||
) +
|
||||
EventType.POLL_START +
|
||||
EventType.STATE_ROOM_BEACON_INFO
|
||||
|
||||
return event.root.getClearType() in canRedactEventTypes &&
|
||||
// Message sent by the current user can always be redacted, else check permission for messages sent by other users
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package im.vector.app.features.home.room.detail.timeline.action
|
||||
|
||||
import im.vector.app.features.voicebroadcast.STATE_ROOM_VOICE_BROADCAST_INFO
|
||||
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
||||
import io.mockk.mockk
|
||||
import org.amshove.kluent.shouldBe
|
||||
|
@ -34,7 +35,7 @@ class CheckIfCanRedactEventUseCaseTest {
|
|||
|
||||
@Test
|
||||
fun `given an event which can be redacted and owned by user when use case executes then the result is true`() {
|
||||
val canRedactEventTypes = listOf(EventType.MESSAGE, EventType.STICKER) +
|
||||
val canRedactEventTypes = listOf(EventType.MESSAGE, EventType.STICKER, STATE_ROOM_VOICE_BROADCAST_INFO) +
|
||||
EventType.POLL_START + EventType.STATE_ROOM_BEACON_INFO
|
||||
|
||||
canRedactEventTypes.forEach { eventType ->
|
||||
|
|
Loading…
Reference in a new issue