Fix sliding-sync room_avatar conditions.
Eliminate jsOption from non-sliding-sync avatar related codepaths. Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -360,7 +360,8 @@ async fn get_room_summary(
|
||||
.services
|
||||
.state_accessor
|
||||
.get_avatar(room_id)
|
||||
.map(|res| res.into_option().unwrap_or_default().url);
|
||||
.map_ok(|content| content.url)
|
||||
.ok();
|
||||
|
||||
let room_version = self.services.state.get_room_version(room_id).ok();
|
||||
|
||||
@@ -397,12 +398,12 @@ async fn get_room_summary(
|
||||
let summary = SpaceHierarchyParentSummary {
|
||||
children_state,
|
||||
summary: RoomSummary {
|
||||
avatar_url: avatar_url.flatten(),
|
||||
canonical_alias,
|
||||
name,
|
||||
topic,
|
||||
world_readable,
|
||||
guest_can_join,
|
||||
avatar_url,
|
||||
room_type,
|
||||
encryption,
|
||||
room_version,
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use futures::{FutureExt, TryFutureExt, future::try_join};
|
||||
use ruma::{
|
||||
EventEncryptionAlgorithm, JsOption, OwnedRoomAliasId, RoomId, UserId,
|
||||
EventEncryptionAlgorithm, OwnedRoomAliasId, RoomId, UserId,
|
||||
events::{
|
||||
StateEventType,
|
||||
room::{
|
||||
@@ -88,13 +88,9 @@ impl Service {
|
||||
.map(|c: RoomNameEventContent| c.name)
|
||||
}
|
||||
|
||||
pub async fn get_avatar(&self, room_id: &RoomId) -> JsOption<RoomAvatarEventContent> {
|
||||
let content = self
|
||||
.room_state_get_content(room_id, &StateEventType::RoomAvatar, "")
|
||||
pub async fn get_avatar(&self, room_id: &RoomId) -> Result<RoomAvatarEventContent> {
|
||||
self.room_state_get_content(room_id, &StateEventType::RoomAvatar, "")
|
||||
.await
|
||||
.ok();
|
||||
|
||||
JsOption::from_option(content)
|
||||
}
|
||||
|
||||
pub async fn get_member(
|
||||
|
||||
Reference in New Issue
Block a user