Skip to content

Conversation

@ganfra
Copy link
Member

@ganfra ganfra commented Jul 30, 2025

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Sorry for the big PR !
This should close all the issues related to new room version, including :

  • New RoomId format
  • Owner role with Creator/SuperAdmin
  • Warn last admin leaving the room/space

Also, the custom values for power levels have been removed.

Motivation and context

Close #9063
Close #9064
Close #9062
Close #9061

Screenshots / GIFs

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@ElementBot
Copy link

ElementBot commented Jul 30, 2025

Fails
🚫

library/ui-strings/src/main/res/values/strings.xml#L127 - The resource R.string.power_level_custom appears to be unused

🚫

library/ui-strings/src/main/res/values/strings.xml#L128 - The resource R.string.power_level_custom_no_value appears to be unused

🚫

library/ui-strings/src/main/res/values/strings.xml#L2384 - The resource R.string.room_member_power_level_custom appears to be unused

🚫

library/ui-strings/src/main/res/values/strings.xml#L2392 - The resource R.string.room_member_power_level_custom_in appears to be unused

Warnings
⚠️

vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt#L980 - Use the KTX extension function String.toUri instead?

⚠️

vector/src/main/java/im/vector/app/features/widgets/WidgetViewModel.kt#L221 - Use the KTX extension function String.toUri instead?

Generated by 🚫 dangerJS against a239f5f

@ganfra ganfra requested a review from jmartinesp July 30, 2025 13:37
Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran a quick few tests and it seems to work fine, thanks! I added a few comments, feel free to ignore them if they don't seem important enough.

Comment on lines +57 to +61
private const val MATRIX_EVENT_IDENTIFIER_V3_REGEX = "\\$$BASE_64_ALPHABET"
private val PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V3 = MATRIX_EVENT_IDENTIFIER_V3_REGEX.toRegex(RegexOption.IGNORE_CASE)

// Ref: https://matrix.org/docs/spec/rooms/v4#event-ids
private const val MATRIX_EVENT_IDENTIFIER_V4_REGEX = "\\$[A-Z0-9\\-_]+"
private const val MATRIX_EVENT_IDENTIFIER_V4_REGEX = "\\$$BASE_64_URL_SAFE_ALPHABET"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change modifies the v3 and v4 regexes so they admit new characters, but I guess we're ok with this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, used same as EX

private val roomGetter: RoomGetter,
@UserId private val userId: String
@UserId private val userId: String,
private val stateEventDataSource: StateEventDataSource,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 18 to 23
internal fun StateEventDataSource.getRoomPowerLevels(roomId: String): RoomPowerLevels {
val powerLevelsContent = getStateEvent(roomId, EventType.STATE_ROOM_POWER_LEVELS, QueryStringValue.IsEmpty)
?.content?.toModel<PowerLevelsContent>()
val roomCreateContent = getStateEvent(roomId, EventType.STATE_ROOM_CREATE, QueryStringValue.IsEmpty)?.getRoomCreateContentWithSender()
return RoomPowerLevels(powerLevelsContent, roomCreateContent)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird to have this code duplicate in Room too. Is there any way to reuse one implementation for the other method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've changed it

val User = Value(0)
val Moderator = Value(50)
val Admin = Value(100)
val SuperAdmin = Value(150)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why SuperAdmin and not Owner?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Owner is an Element thing, not a matrix one

@ganfra ganfra merged commit f1a99c3 into develop Aug 4, 2025
8 of 12 checks passed
@ganfra ganfra deleted the feature/room_v12_support branch August 4, 2025 18:20
@catfromplan9
Copy link

This has caused my client to show e.g. $25 as a link, and now custom power levels cannot be set either. Please fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants