User could not redact messages that he has sent (#1543)
This commit is contained in:
parent
3f44056243
commit
94b5e4e2f8
|
@ -11,6 +11,7 @@ Improvements 🙌:
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
- Fix dark theme issue on login screen (#1097)
|
- Fix dark theme issue on login screen (#1097)
|
||||||
- Incomplete predicate in RealmCryptoStore#getOutgoingRoomKeyRequest (#1519)
|
- Incomplete predicate in RealmCryptoStore#getOutgoingRoomKeyRequest (#1519)
|
||||||
|
- User could not redact message that they have sent (#1543)
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -52,7 +52,7 @@ data class MessageActionState(
|
||||||
val actions: List<EventSharedAction> = emptyList(),
|
val actions: List<EventSharedAction> = emptyList(),
|
||||||
val expendedReportContentMenu: Boolean = false,
|
val expendedReportContentMenu: Boolean = false,
|
||||||
val actionPermissions: ActionPermissions = ActionPermissions()
|
val actionPermissions: ActionPermissions = ActionPermissions()
|
||||||
) : MvRxState {
|
) : MvRxState {
|
||||||
|
|
||||||
constructor(args: TimelineEventFragmentArgs) : this(roomId = args.roomId, eventId = args.eventId, informationData = args.informationData)
|
constructor(args: TimelineEventFragmentArgs) : this(roomId = args.roomId, eventId = args.eventId, informationData = args.informationData)
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ import im.vector.riotx.core.platform.EmptyViewEvents
|
||||||
import im.vector.riotx.core.platform.VectorViewModel
|
import im.vector.riotx.core.platform.VectorViewModel
|
||||||
import im.vector.riotx.core.resources.StringProvider
|
import im.vector.riotx.core.resources.StringProvider
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.format.NoticeEventFormatter
|
import im.vector.riotx.features.home.room.detail.timeline.format.NoticeEventFormatter
|
||||||
import im.vector.riotx.features.powerlevel.PowerLevelsObservableFactory
|
|
||||||
import im.vector.riotx.features.html.EventHtmlRenderer
|
import im.vector.riotx.features.html.EventHtmlRenderer
|
||||||
import im.vector.riotx.features.html.VectorHtmlCompressor
|
import im.vector.riotx.features.html.VectorHtmlCompressor
|
||||||
|
import im.vector.riotx.features.powerlevel.PowerLevelsObservableFactory
|
||||||
import im.vector.riotx.features.reactions.data.EmojiDataSource
|
import im.vector.riotx.features.reactions.data.EmojiDataSource
|
||||||
import im.vector.riotx.features.settings.VectorPreferences
|
import im.vector.riotx.features.settings.VectorPreferences
|
||||||
|
|
||||||
|
@ -357,6 +357,9 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
||||||
private fun canRedact(event: TimelineEvent, actionPermissions: ActionPermissions): Boolean {
|
private fun canRedact(event: TimelineEvent, actionPermissions: ActionPermissions): Boolean {
|
||||||
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
|
// Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
|
||||||
if (event.root.getClearType() != EventType.MESSAGE) return false
|
if (event.root.getClearType() != EventType.MESSAGE) return false
|
||||||
|
// Message sent by the current user can always be redacted
|
||||||
|
if (event.root.senderId == session.myUserId) return true
|
||||||
|
// Check permission for messages sent by other users
|
||||||
return actionPermissions.canRedact
|
return actionPermissions.canRedact
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue