mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-28 02:38:30 +00:00
31 lines
539 B
Rust
31 lines
539 B
Rust
|
pub(crate) use conduit::utils::HtmlEscape;
|
||
|
use ruma::OwnedRoomId;
|
||
|
|
||
|
use crate::services;
|
||
|
|
||
|
pub(crate) fn escape_html(s: &str) -> String {
|
||
|
s.replace('&', "&")
|
||
|
.replace('<', "<")
|
||
|
.replace('>', ">")
|
||
|
}
|
||
|
|
||
|
pub(crate) fn get_room_info(id: &OwnedRoomId) -> (OwnedRoomId, u64, String) {
|
||
|
(
|
||
|
id.clone(),
|
||
|
services()
|
||
|
.rooms
|
||
|
.state_cache
|
||
|
.room_joined_count(id)
|
||
|
.ok()
|
||
|
.flatten()
|
||
|
.unwrap_or(0),
|
||
|
services()
|
||
|
.rooms
|
||
|
.state_accessor
|
||
|
.get_name(id)
|
||
|
.ok()
|
||
|
.flatten()
|
||
|
.unwrap_or_else(|| id.to_string()),
|
||
|
)
|
||
|
}
|