mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 09:34:04 +00:00 
			
		
		
		
	Can change the visibility level of a post
This commit is contained in:
		@@ -383,6 +383,14 @@ pub fn allow_comments_on_post(p: &Post) -> ResultBoxError<bool> {
 | 
			
		||||
            user_helper::allow_comments(p.user_page_id().unwrap_or(&UserID::invalid()))?)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Set a new visibility level to a post
 | 
			
		||||
pub fn set_level(post_id: u64, level: PostVisibilityLevel) -> ResultBoxError {
 | 
			
		||||
    database::UpdateInfo::new(POSTS_TABLE)
 | 
			
		||||
        .cond_u64("ID", post_id)
 | 
			
		||||
        .set_u32("niveau_visibilite", level.to_db())
 | 
			
		||||
        .exec()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Turn a post into a database entry
 | 
			
		||||
fn db_to_post(res: &database::RowResult) -> ResultBoxError<Post> {
 | 
			
		||||
    let user_id = if res.get_u64("ID_amis")? == 0 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user