[fractal] Fix Error searching for rooms at startup



commit 3bceb012a0a56cbe8f20434419f9ef0c9d4aefc8
Author: Julian Sparber <julian sparber net>
Date:   Mon Feb 3 14:57:56 2020 +0100

    Fix Error searching for rooms at startup
    
    The api thirdparty/protocols does (sometimes?) also return protocols with
    no protocol definition e.g {xmpp: {}} with no values.
    Since the no values are defined the parsing of the json fails.
    This works around the problem by falling back to the default
    implementation of "Protocol".
    
    Fixes: https://gitlab.gnome.org/GNOME/fractal/issues/538

 fractal-matrix-api/src/r0/thirdparty/get_supported_protocols.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/fractal-matrix-api/src/r0/thirdparty/get_supported_protocols.rs 
b/fractal-matrix-api/src/r0/thirdparty/get_supported_protocols.rs
index 93c188dd..2aa60878 100644
--- a/fractal-matrix-api/src/r0/thirdparty/get_supported_protocols.rs
+++ b/fractal-matrix-api/src/r0/thirdparty/get_supported_protocols.rs
@@ -15,7 +15,8 @@ pub struct Parameters {
 
 pub type Response = BTreeMap<String, Protocol>;
 
-#[derive(Debug, Clone, Deserialize)]
+#[derive(Debug, Clone, Deserialize, Default)]
+#[serde(default)]
 pub struct Protocol {
     pub user_fields: Vec<String>,
     pub location_fields: Vec<String>,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]