pub fn censor_post(post_uuid: PostUuid, conn: &PgConnection) -> BackendResult<ChildlessPostData> {
        use crate::schema::posts::{
            self,
            dsl::*,
        };

        let m_post_uuid: Uuid = post_uuid.0;

        let censored_post: Post = diesel::update(posts::table)
            .filter(posts::uuid.eq(m_post_uuid))
            .set(censored.eq(true))
            .get_result(conn)
            .map_err(handle_err::<Post>)?;
        let author_uuid_a = UserUuid(censored_post.author_uuid);
        let user = User::get_user(author_uuid_a, conn)?;
        let user_uuid = UserUuid(user.uuid);
        let votes = Post::get_vote_counts(&censored_post, user_uuid, conn)?;

        Ok(ChildlessPostData {
            post: censored_post,
            user,
            votes,
        })
    }
/// Censors the post, preventing users from seeing it by default.
Censors the post, preventing users from seeing it by default.
Censors the post preventing users from seeing it by default .
pub fn censor_post(post_uuid: PostUuid, conn: &PgConnection) -> BackendResult<ChildlessPostData> {
        use crate::schema::posts::{
            self,
            dsl::*,
        };
        let m_post_uuid: Uuid = post_uuid.0;
        let censored_post: Post = diesel::update(posts::table)
            .filter(posts::uuid.eq(m_post_uuid))
            .set(censored.eq(true))
            .get_result(conn)
            .map_err(handle_err::<Post>)?;
        let author_uuid_a = UserUuid(censored_post.author_uuid);
        let user = User::get_user(author_uuid_a, conn)?;
        let user_uuid = UserUuid(user.uuid);
        let votes = Post::get_vote_counts(&censored_post, user_uuid, conn)?;
        Ok(ChildlessPostData {
            post: censored_post,
            user,
            votes,
        })
    }
pub fn censor_post ( post_uuid : PostUuid , conn : & PgConnection ) -> BackendResult < ChildlessPostData > { use crate :: schema :: posts :: { self , dsl :: * , } ; let m_post_uuid : Uuid = post_uuid . 0 ; let censored_post : Post = diesel :: update ( posts :: table ) . filter ( posts :: uuid . eq ( m_post_uuid ) ) . set ( censored . eq ( true ) ) . get_result ( conn ) . map_err ( handle_err :: < Post > ) ? ; let author_uuid_a = UserUuid ( censored_post . author_uuid ) ; let user = User :: get_user ( author_uuid_a , conn ) ? ; let user_uuid = UserUuid ( user . uuid ) ; let votes = Post :: get_vote_counts ( & censored_post , user_uuid , conn ) ? ; Ok ( ChildlessPostData { post : censored_post , user , votes , } ) }
Censors the post, preventing users from seeing it by default.
Censors the post preventing users from seeing it by default .
post_uuid
PostUuid
conn
&PgConnection
post_uuid
PostUuid
conn
&PgConnection