-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove "X kicked X" terminology when removing people from a room #4911
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a lot to say, this is really nice work, thanks!
@@ -77,7 +77,7 @@ interface MembershipService { | |||
/** | |||
* Kick a user from the room | |||
*/ | |||
suspend fun kick(userId: String, reason: String? = null) | |||
suspend fun remove(userId: String, reason: String? = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also update the comment above
@@ -77,7 +77,7 @@ interface MembershipService { | |||
/** | |||
* Kick a user from the room | |||
*/ | |||
suspend fun kick(userId: String, reason: String? = null) | |||
suspend fun remove(userId: String, reason: String? = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it is a change in the SDK api, would be better to keep kick
as an alias to remove and mark it as deprecated.
You can write in the interface something like:
@Deprecated("Use remove now")
suspend fun kick(userId: String, reason: String? = null) = remove(userId, reason)
JOIN_SPACE("/joinSpace", "spaceId", R.string.command_description_join_space, true), | ||
LEAVE_ROOM("/leave", "<roomId?>", R.string.command_description_leave_room, true), | ||
UPGRADE_ROOM("/upgraderoom", "newVersion", R.string.command_description_upgrade_room, true); | ||
enum class Command(val command: String, val aliases: Array<CharSequence>?, val parameters: String, @StringRes val description: Int, val isDevCommand: Boolean) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a strong opinion about it, but why using Array
instead of List
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it because of spread operation used later here
val allAliases = arrayOf(command, *aliases.orEmpty())
@@ -32,12 +32,12 @@ object CommandParser { | |||
* @param textMessage the text message | |||
* @return a parsed slash command (ok or error) | |||
*/ | |||
fun parseSplashCommand(textMessage: CharSequence): ParsedCommand { | |||
fun parseSlashCommand(textMessage: CharSequence): ParsedCommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, nice typo, thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(my bad eae8f99 :) )
// check if it has the Slash marker | ||
if (!textMessage.startsWith("/")) { | ||
return ParsedCommand.ErrorNotACommand | ||
} else { | ||
Timber.v("parseSplashCommand") | ||
Timber.v("parseSlashCommand") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the logs does not impact analytics.
if (newVersion.isEmpty()) { | ||
ParsedCommand.ErrorSyntax(Command.UPGRADE_ROOM) | ||
Command.ADD_TO_SPACE.matches(slashCommand) -> { | ||
ParsedCommand.AddToSpace(spaceId = message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we miss some validation of message
for this command and the one below.
|
||
private fun trimParts(message: CharSequence, messageParts: List<String>): String? { | ||
val partsSize = messageParts.sumOf { it.length } | ||
val gapsNumber = messageParts.size - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if it still works well if the user adds more space chars between the params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked this case and it worked well. It just trims every space betwen params
@@ -25,8 +25,8 @@ | |||
<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_by_you">You rejected the invitation</string> | |||
<string name="notice_room_kick">%1$s kicked %2$s</string> | |||
<string name="notice_room_kick_by_you">You kicked %1$s</string> | |||
<string name="notice_room_kick">%1$s removed %2$s</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a TODO in XML comment above so that I will not forget to rename during the next weblate sync. Thanks. (only one comment will be enough)
changelog.d/4865.misc
Outdated
@@ -0,0 +1 @@ | |||
"/kick" command is replaced with "/remove" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also mention the replacement in the wordings.
Matrix SDKIntegration Tests Results:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
there are three separate commits:
also there are some small fixes/changes:
/rainbow - posts empty message
/spoiler - posts empty message
/me - posts message with just user name
/rainbowme - posts message with just user name
fixes #4865