diff --git a/src/controllers/likes_controller.rs b/src/controllers/likes_controller.rs index 37b36ca..f37aa8b 100644 --- a/src/controllers/likes_controller.rs +++ b/src/controllers/likes_controller.rs @@ -4,6 +4,7 @@ use crate::controllers::routes::RequestResult; use crate::data::error::ExecError; +use crate::data::group::GroupAccessLevel; use crate::data::http_request_handler::HttpRequestHandler; use crate::data::post::PostAccessLevel; use crate::helpers::{likes_helper, user_helper}; @@ -45,6 +46,12 @@ pub fn update(r: &mut HttpRequestHandler) -> RequestResult { LikeTarget(comment.id, LikeType::COMMENT) } + // In case of group + "group" => { + let group_id = r.post_group_id_with_access("id", GroupAccessLevel::VIEW_ACCESS)?; + LikeTarget(group_id.id(), LikeType::GROUP) + } + _ => { r.internal_error(ExecError::boxed_new("Unsupported like type!"))?; unreachable!();