mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Can create weblink posts
This commit is contained in:
@ -9,7 +9,7 @@ use crate::controllers::routes::RequestResult;
|
||||
use crate::data::error::{ExecError, ResultBoxError};
|
||||
use crate::data::group::GroupAccessLevel;
|
||||
use crate::data::http_request_handler::HttpRequestHandler;
|
||||
use crate::data::post::{Post, PostAccessLevel, PostFile, PostKind, PostPageKind, PostVisibilityLevel};
|
||||
use crate::data::post::{Post, PostAccessLevel, PostFile, PostKind, PostPageKind, PostVisibilityLevel, PostWebLink};
|
||||
use crate::helpers::{groups_helper, posts_helper, user_helper};
|
||||
use crate::utils::date_utils::time;
|
||||
use crate::utils::string_utils::{check_string_before_insert, check_youtube_id};
|
||||
@ -159,6 +159,21 @@ pub fn create_post(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
PostKind::POST_KIND_MOVIE(movie_id)
|
||||
}
|
||||
|
||||
// Weblink posts
|
||||
"weblink" => {
|
||||
let url = r.post_url_opt("url", true)?
|
||||
.ok_or(ExecError::new("Missing url!"))?;
|
||||
|
||||
// For now, for safety, we do not fetch page content
|
||||
// But this might change in the future
|
||||
PostKind::POST_KIND_WEBLINK(PostWebLink {
|
||||
url,
|
||||
title: None,
|
||||
description: None,
|
||||
image: None,
|
||||
})
|
||||
}
|
||||
|
||||
// TODO : add support for next types
|
||||
|
||||
_ => {
|
||||
|
Reference in New Issue
Block a user