mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 09:34:04 +00:00 
			
		
		
		
	Add post with weblink support
This commit is contained in:
		@@ -4,8 +4,8 @@
 | 
			
		||||
 | 
			
		||||
use crate::constants::database_tables_names::POSTS_TABLE;
 | 
			
		||||
use crate::data::error::{ExecError, ResultBoxError};
 | 
			
		||||
use crate::data::post::{Post, PostFile, PostKind, PostPageKind, PostVisibilityLevel};
 | 
			
		||||
use crate::data::post::PostKind::POST_KIND_IMAGE;
 | 
			
		||||
use crate::data::post::{Post, PostFile, PostKind, PostPageKind, PostVisibilityLevel, PostWebLink};
 | 
			
		||||
use crate::data::post::PostKind::{POST_KIND_IMAGE, POST_KIND_WEBLINK};
 | 
			
		||||
use crate::data::user::UserID;
 | 
			
		||||
use crate::helpers::{database, friends_helper};
 | 
			
		||||
use crate::utils::date_utils::time;
 | 
			
		||||
@@ -161,6 +161,13 @@ fn db_to_post(res: &database::RowResult) -> ResultBoxError<Post> {
 | 
			
		||||
    match res.get_str("type")?.as_str() {
 | 
			
		||||
        "image" => post.kind = POST_KIND_IMAGE(file?),
 | 
			
		||||
 | 
			
		||||
        "webpage_link" => post.kind = POST_KIND_WEBLINK(PostWebLink {
 | 
			
		||||
            url: res.get_str("url_page")?,
 | 
			
		||||
            title: res.get_optional_str("titre_page")?,
 | 
			
		||||
            description: res.get_optional_str("description_page")?,
 | 
			
		||||
            image: res.get_optional_str("image_page")?,
 | 
			
		||||
        }),
 | 
			
		||||
 | 
			
		||||
        _ => {}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user