[fractal/fix-room-search-other-servers: 2/2] directory: Fix search for other homeservers
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fix-room-search-other-servers: 2/2] directory: Fix search for other homeservers
- Date: Wed, 5 Aug 2020 06:13:40 +0000 (UTC)
commit de339b569f9c1dca025426d6710463bd39dcf3e3
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Tue Aug 4 10:34:31 2020 +0200
directory: Fix search for other homeservers
The matrix server request expect the "server" parameter to be a string.
If the "server" in Parameters is "Option<Host<String>>" it serializes to
somethign like 'Domain("matrix.org")'.
This patch makes the server parameter a string so the request is built
correctly everytime. The "Host" enum is converted to an string during
the parsing.
fractal-gtk/src/backend/directory.rs | 2 ++
fractal-matrix-api/src/r0/directory/post_public_rooms.rs | 3 +--
2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/fractal-gtk/src/backend/directory.rs b/fractal-gtk/src/backend/directory.rs
index 51e0324a..68da99aa 100644
--- a/fractal-gtk/src/backend/directory.rs
+++ b/fractal-gtk/src/backend/directory.rs
@@ -105,6 +105,8 @@ pub fn room_search(
.map(Host::to_owned)
.map(Ok)
.unwrap_or_else(|| Host::parse(&hs))
+ // Remove the url::Host enum, we only need the domain string
+ .map(|host| host.to_string())
.map(Some)
})
.unwrap_or(Ok(None))
diff --git a/fractal-matrix-api/src/r0/directory/post_public_rooms.rs
b/fractal-matrix-api/src/r0/directory/post_public_rooms.rs
index c6839112..9d9ac079 100644
--- a/fractal-matrix-api/src/r0/directory/post_public_rooms.rs
+++ b/fractal-matrix-api/src/r0/directory/post_public_rooms.rs
@@ -6,14 +6,13 @@ use ruma_identifiers::RoomAliasId;
use ruma_identifiers::RoomId;
use serde::ser::SerializeMap;
use serde::{Deserialize, Serialize, Serializer};
-use url::Host;
use url::Url;
#[derive(Clone, Debug, Serialize)]
pub struct Parameters {
pub access_token: AccessToken,
#[serde(skip_serializing_if = "Option::is_none")]
- pub server: Option<Host<String>>,
+ pub server: Option<String>,
}
#[derive(Clone, Debug, Serialize)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]