mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
getRedactionReason function is refactored.
This commit is contained in:
parent
1b413934b5
commit
983593d647
1 changed files with 11 additions and 9 deletions
|
@ -214,15 +214,17 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
||||||
?.get("reason") as? String)
|
?.get("reason") as? String)
|
||||||
?.takeIf { it.isNotBlank() }
|
?.takeIf { it.isNotBlank() }
|
||||||
?.let { reason ->
|
?.let { reason ->
|
||||||
stringProvider.getString(
|
when (timelineEvent.root.senderId == session.myUserId) {
|
||||||
(R.string.event_redacted_by_user_reason_with_reason
|
true -> stringProvider.getString(R.string.event_redacted_by_user_reason_with_reason, reason)
|
||||||
.takeIf { timelineEvent.root.senderId == session.myUserId }
|
false -> stringProvider.getString(R.string.event_redacted_by_admin_reason_with_reason, reason)
|
||||||
?: R.string.event_redacted_by_admin_reason_with_reason), reason
|
}
|
||||||
)
|
}
|
||||||
} ?: stringProvider.getString(
|
?: run {
|
||||||
R.string.event_redacted_by_user_reason
|
when (timelineEvent.root.senderId == session.myUserId) {
|
||||||
.takeIf { timelineEvent.root.senderId == session.myUserId }
|
true -> stringProvider.getString(R.string.event_redacted_by_user_reason)
|
||||||
?: R.string.event_redacted_by_admin_reason_with_reason)
|
false -> stringProvider.getString(R.string.event_redacted_by_admin_reason)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun actionsForEvent(timelineEvent: TimelineEvent): List<EventSharedAction> {
|
private fun actionsForEvent(timelineEvent: TimelineEvent): List<EventSharedAction> {
|
||||||
val messageContent: MessageContent? = timelineEvent.annotations?.editSummary?.aggregatedContent.toModel()
|
val messageContent: MessageContent? = timelineEvent.annotations?.editSummary?.aggregatedContent.toModel()
|
||||||
|
|
Loading…
Reference in a new issue