]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/impls/post.rs
Embed Peertube videos (#2261)
[lemmy.git] / crates / db_schema / src / impls / post.rs
index c1f0fcbf231279abf6bb607e5a4b2f72fbbe6844..03a4b7192ba939fe351725d5245992c84ee669f9 100644 (file)
@@ -1,5 +1,4 @@
 use crate::{
-  naive_now,
   newtypes::{CommunityId, DbUrl, PersonId, PostId},
   source::post::{
     Post,
@@ -12,6 +11,7 @@ use crate::{
     PostSavedForm,
   },
   traits::{Crud, DeleteableOrRemoveable, Likeable, Readable, Saveable},
+  utils::naive_now,
 };
 use diesel::{dsl::*, result::Error, ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
 use url::Url;
@@ -50,6 +50,8 @@ impl Post {
     use crate::schema::post::dsl::*;
     post
       .filter(community_id.eq(the_community_id))
+      .filter(deleted.eq(false))
+      .filter(removed.eq(false))
       .then_order_by(published.desc())
       .then_order_by(stickied.desc())
       .limit(20)
@@ -249,7 +251,7 @@ impl DeleteableOrRemoveable for Post {
     self.body = None;
     self.embed_title = None;
     self.embed_description = None;
-    self.embed_html = None;
+    self.embed_video_url = None;
     self.thumbnail_url = None;
 
     self
@@ -259,13 +261,13 @@ impl DeleteableOrRemoveable for Post {
 #[cfg(test)]
 mod tests {
   use crate::{
-    establish_unpooled_connection,
     source::{
       community::{Community, CommunityForm},
       person::*,
       post::*,
     },
     traits::{Crud, Likeable, Readable, Saveable},
+    utils::establish_unpooled_connection,
   };
   use serial_test::serial;
 
@@ -314,7 +316,7 @@ mod tests {
       updated: None,
       embed_title: None,
       embed_description: None,
-      embed_html: None,
+      embed_video_url: None,
       thumbnail_url: None,
       ap_id: inserted_post.ap_id.to_owned(),
       local: true,