about summary refs log tree commit diff
path: root/src/database
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2021-12-05 22:05:36 +0300
committerVika <vika@fireburn.ru>2021-12-05 22:05:36 +0300
commit24b109448bc8f1d30c88bbb9d01a05eec74b3d51 (patch)
tree5895296d6f0b6d6ba148f598718bbaf3fa0c8c7f /src/database
parent29f248d8b06f062d5fe552da09a59b91d67118f5 (diff)
downloadkittybox-24b109448bc8f1d30c88bbb9d01a05eec74b3d51.tar.zst
frontend: Added listing feeds to the header bar
Diffstat (limited to 'src/database')
-rw-r--r--src/database/file/mod.rs6
-rw-r--r--src/database/mod.rs10
2 files changed, 6 insertions, 10 deletions
diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs
index 1e0102a..67b3549 100644
--- a/src/database/file/mod.rs
+++ b/src/database/file/mod.rs
@@ -346,12 +346,12 @@ impl Storage for FileStorage {
         Ok(())
     }
 
-    async fn get_channels(
+    async fn get_channels<'a>(
         &self,
-        user: &crate::indieauth::User,
+        user: &'a str,
     ) -> Result<Vec<super::MicropubChannel>> {
         let mut path = relative_path::RelativePathBuf::new();
-        path.push(&user.me.to_string());
+        path.push(user.to_string());
         path.push("channels");
 
         let path = path.to_path(&self.root_dir);
diff --git a/src/database/mod.rs b/src/database/mod.rs
index 339439d..a57e243 100644
--- a/src/database/mod.rs
+++ b/src/database/mod.rs
@@ -210,8 +210,8 @@ pub trait Storage: Clone + Send + Sync {
     /// The last update always wins.
     async fn update_post<'a>(&self, url: &'a str, update: serde_json::Value) -> Result<()>;
 
-    /// Get a list of channels available for the user represented by the `user` object to write.
-    async fn get_channels(&self, user: &User) -> Result<Vec<MicropubChannel>>;
+    /// Get a list of channels available for the user represented by the URL `user` to write to.
+    async fn get_channels<'a>(&self, user: &'a str) -> Result<Vec<MicropubChannel>>;
 
     /// Fetch a feed at `url` and return a an h-feed object containing
     /// `limit` posts after a post by url `after`, filtering the content
@@ -386,11 +386,7 @@ mod tests {
             .await
             .unwrap();
         let chans = backend
-            .get_channels(&crate::indieauth::User::new(
-                "https://fireburn.ru/",
-                "https://quill.p3k.io/",
-                "create update media",
-            ))
+            .get_channels("https://fireburn.ru/")
             .await
             .unwrap();
         assert_eq!(chans.len(), 1);