code review changes

This commit is contained in:
fedrunov 2022-01-13 17:50:38 +01:00
parent 9fa38c5cc5
commit d92e0e48f6
5 changed files with 21 additions and 5 deletions

View File

@ -1 +1 @@
"/kick" command is replaced with "/remove" "/kick" command is replaced with "/remove". Also replaced all occurrences in string resources

View File

@ -75,10 +75,13 @@ interface MembershipService {
suspend fun unban(userId: String, reason: String? = null) suspend fun unban(userId: String, reason: String? = null)
/** /**
* Kick a user from the room * Remove a user from the room
*/ */
suspend fun remove(userId: String, reason: String? = null) suspend fun remove(userId: String, reason: String? = null)
@Deprecated("Use remove instead", ReplaceWith("remove(userId, reason)"))
suspend fun kick(userId: String, reason: String? = null) = remove(userId, reason)
/** /**
* Join the room, or accept an invitation. * Join the room, or accept an invitation.
*/ */

View File

@ -24,7 +24,11 @@ import im.vector.app.R
* the user can write theses messages to perform some actions * the user can write theses messages to perform some actions
* the list will be displayed in this order * the list will be displayed in this order
*/ */
enum class Command(val command: String, val aliases: Array<CharSequence>?, val parameters: String, @StringRes val description: Int, val isDevCommand: Boolean) { enum class Command(val command: String,
val aliases: Array<CharSequence>?,
val parameters: String,
@StringRes val description: Int,
val isDevCommand: Boolean) {
EMOTE("/me", null, "<message>", R.string.command_description_emote, false), EMOTE("/me", null, "<message>", R.string.command_description_emote, false),
BAN_USER("/ban", null, "<user-id> [reason]", R.string.command_description_ban_user, false), BAN_USER("/ban", null, "<user-id> [reason]", R.string.command_description_ban_user, false),
UNBAN_USER("/unban", null, "<user-id> [reason]", R.string.command_description_unban_user, false), UNBAN_USER("/unban", null, "<user-id> [reason]", R.string.command_description_unban_user, false),

View File

@ -370,10 +370,18 @@ object CommandParser {
} }
} }
Command.ADD_TO_SPACE.matches(slashCommand) -> { Command.ADD_TO_SPACE.matches(slashCommand) -> {
ParsedCommand.AddToSpace(spaceId = message) if (messageParts.size == 1) {
ParsedCommand.AddToSpace(spaceId = message)
} else {
ParsedCommand.ErrorSyntax(Command.ADD_TO_SPACE)
}
} }
Command.JOIN_SPACE.matches(slashCommand) -> { Command.JOIN_SPACE.matches(slashCommand) -> {
ParsedCommand.JoinSpace(spaceIdOrAlias = message) if (messageParts.size == 1) {
ParsedCommand.JoinSpace(spaceIdOrAlias = message)
} else {
ParsedCommand.ErrorSyntax(Command.JOIN_SPACE)
}
} }
Command.LEAVE_ROOM.matches(slashCommand) -> { Command.LEAVE_ROOM.matches(slashCommand) -> {
ParsedCommand.LeaveRoom(roomId = message) ParsedCommand.LeaveRoom(roomId = message)

View File

@ -25,6 +25,7 @@
<string name="notice_direct_room_leave_by_you">You left the room</string> <string name="notice_direct_room_leave_by_you">You left the room</string>
<string name="notice_room_reject">%1$s rejected the invitation</string> <string name="notice_room_reject">%1$s rejected the invitation</string>
<string name="notice_room_reject_by_you">You rejected the invitation</string> <string name="notice_room_reject_by_you">You rejected the invitation</string>
<!-- TODO: replace "kick" with "remove" in string resources keys -->
<string name="notice_room_kick">%1$s removed %2$s</string> <string name="notice_room_kick">%1$s removed %2$s</string>
<string name="notice_room_kick_by_you">You removed %1$s</string> <string name="notice_room_kick_by_you">You removed %1$s</string>
<string name="notice_room_unban">%1$s unbanned %2$s</string> <string name="notice_room_unban">%1$s unbanned %2$s</string>