Discard session command only encrypted room
This commit is contained in:
parent
9b320ed3c7
commit
d0f776a9cf
|
@ -44,7 +44,7 @@ enum class Command(val command: String, val parameters: String, @StringRes val d
|
|||
POLL("/poll", "Question | Option 1 | Option 2 ...", R.string.command_description_poll),
|
||||
SHRUG("/shrug", "<message>", R.string.command_description_shrug),
|
||||
PLAIN("/plain", "<message>", R.string.command_description_plain),
|
||||
DISCARD_SESSION("/discardsession", "<message>", R.string.command_description_discard_session),
|
||||
DISCARD_SESSION("/discardsession","", R.string.command_description_discard_session),
|
||||
// TODO temporary command
|
||||
VERIFY_USER("/verify", "<user-id>", R.string.command_description_verify);
|
||||
|
||||
|
|
|
@ -448,7 +448,17 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||
_viewEvents.post(RoomDetailViewEvents.SlashCommandNotImplemented)
|
||||
}
|
||||
is ParsedCommand.DiscardSession -> {
|
||||
session.cryptoService().discardOutbundSession(room.roomId)
|
||||
if (room.isEncrypted()) {
|
||||
session.cryptoService().discardOutbundSession(room.roomId)
|
||||
_viewEvents.post(RoomDetailViewEvents.SlashCommandHandled())
|
||||
popDraft()
|
||||
} else {
|
||||
_viewEvents.post(RoomDetailViewEvents.SlashCommandHandled())
|
||||
_viewEvents.post(
|
||||
RoomDetailViewEvents
|
||||
.ShowMessage(stringProvider.getString(R.string.command_description_discard_session_not_handled))
|
||||
)
|
||||
}
|
||||
}
|
||||
}.exhaustive
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
<!-- BEGIN Strings added by Valere -->
|
||||
<string name="command_description_discard_session">Forces the current outbound group session in an encrypted room to be discarded</string>
|
||||
<string name="command_description_discard_session_not_handled">Only supported in encrypted rooms</string>
|
||||
<!-- END Strings added by Valere -->
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue