Support inline HTML/links for room topic

This commit is contained in:
miruka 2019-09-11 16:01:37 -04:00
parent e53f6ed292
commit 0e6b6c830d
4 changed files with 6 additions and 6 deletions

View File

@ -36,8 +36,6 @@
- UI
- Show error if uploading avatar fails or file is corrupted
- Way to open context menus without a right mouse button
- Room header descriptions: support URLs
- Also support URLs for "room topic changed" event messages
- Indeterminate progress bar
- Message selection

View File

@ -459,7 +459,7 @@ class MatrixClient(nio.AsyncClient):
room_id = room.room_id,
display_name = room.display_name,
avatar_url = room.gen_avatar_url or "",
topic = room.topic or "",
topic = HTML_FILTER.filter_inline(room.topic or ""),
inviter_id = inviter,
inviter_name = room.user_name(inviter) if inviter else "",
inviter_avatar =
@ -780,7 +780,8 @@ class MatrixClient(nio.AsyncClient):
async def onRoomTopicEvent(self, room, ev) -> None:
co = f"%1 changed the room's topic to \"{ev.topic}\"."
topic = HTML_FILTER.filter_inline(ev.topic)
co = f"%1 changed the room's topic to \"{topic}\"."
await self.register_nio_event(room, ev, content=co)

View File

@ -7,7 +7,7 @@ ToolTip {
padding: background.border.width
contentWidth: Math.min(
mainUI.width / 1.25,
contentItem.implicitWidth,
// contentItem.implicitWidth,
theme.fontSize.normal * 0.5 * 75,
)

View File

@ -47,9 +47,10 @@ Rectangle {
HoverHandler { id: nameHover }
}
HLabel {
HRichLabel {
id: roomTopic
text: chatPage.roomInfo.topic
textFormat: Text.StyledText
font.pixelSize: theme.fontSize.small
color: theme.chat.roomHeader.topic
elide: Text.ElideRight