]> Untitled Git - lemmy.git/blobdiff - crates/db_views_actor/src/community_follower_view.rs
Revert "Add pending, and change use specific API response for FollowCommunity…" ...
[lemmy.git] / crates / db_views_actor / src / community_follower_view.rs
index 379d70958a176d0198c5a24b95d83e3468f76156..6d5d94a596cb30c338ad2a8dea0a4ce2cc840973 100644 (file)
@@ -1,3 +1,4 @@
+use crate::structs::CommunityFollowerView;
 use diesel::{result::Error, *};
 use lemmy_db_schema::{
   newtypes::{CommunityId, PersonId},
@@ -8,13 +9,6 @@ use lemmy_db_schema::{
   },
   traits::{ToSafe, ViewToVec},
 };
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct CommunityFollowerView {
-  pub community: CommunitySafe,
-  pub follower: PersonSafe,
-}
 
 type CommunityFollowerViewTuple = (CommunitySafe, PersonSafe);
 
@@ -28,7 +22,7 @@ impl CommunityFollowerView {
         Person::safe_columns_tuple(),
       ))
       .filter(community_follower::community_id.eq(community_id))
-      .order_by(community_follower::published)
+      .order_by(community::title)
       .load::<CommunityFollowerViewTuple>(conn)?;
 
     Ok(Self::from_tuple_to_vec(res))
@@ -43,7 +37,7 @@ impl CommunityFollowerView {
         Person::safe_columns_tuple(),
       ))
       .filter(community_follower::person_id.eq(person_id))
-      .order_by(community_follower::published)
+      .order_by(community::title)
       .load::<CommunityFollowerViewTuple>(conn)?;
 
     Ok(Self::from_tuple_to_vec(res))