-// TODO Maybe add post, comment searching / caching at a later time
-// fn upsert_post(post_form: &PostForm, conn: &PgConnection) -> Result<Post, Error> {
-// let existing = Post::read_from_apub_id(conn, &post_form.ap_id);
-// match existing {
-// Err(NotFound {}) => Ok(Post::create(conn, &post_form)?),
-// Ok(p) => Ok(Post::update(conn, p.id, &post_form)?),
-// Err(e) => Err(Error::from(e)),
-// }
-// }
+fn upsert_post(post_form: &PostForm, conn: &PgConnection) -> Result<Post, Error> {
+ let existing = Post::read_from_apub_id(conn, &post_form.ap_id);
+ match existing {
+ Err(NotFound {}) => Ok(Post::create(conn, &post_form)?),
+ Ok(p) => Ok(Post::update(conn, p.id, &post_form)?),
+ Err(e) => Err(Error::from(e)),
+ }
+}