mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-04-05 12:19:20 +00:00
Can delete a comment
This commit is contained in:
parent
5a5bf8c5c3
commit
d23411dca7
@ -66,4 +66,13 @@ pub fn edit(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
comments_helper::edit(comment.id, &new_content)?;
|
comments_helper::edit(comment.id, &new_content)?;
|
||||||
|
|
||||||
r.success("Content updated.")
|
r.success("Content updated.")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Delete a comment
|
||||||
|
pub fn delete(r: &mut HttpRequestHandler) -> RequestResult {
|
||||||
|
let comment = r.post_comment_with_full_access("commentID")?;
|
||||||
|
|
||||||
|
comments_helper::delete(&comment)?;
|
||||||
|
|
||||||
|
r.success("Comment deleted.")
|
||||||
}
|
}
|
@ -223,7 +223,9 @@ pub fn get_routes() -> Vec<Route> {
|
|||||||
|
|
||||||
Route::post("/comments/get_single", Box::new(comments_controller::get_single)),
|
Route::post("/comments/get_single", Box::new(comments_controller::get_single)),
|
||||||
|
|
||||||
Route::post("/comments/edit",Box::new(comments_controller::edit)),
|
Route::post("/comments/edit", Box::new(comments_controller::edit)),
|
||||||
|
|
||||||
|
Route::post("/comments/delete", Box::new(comments_controller::delete)),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user