1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 21:39:21 +00:00

Can update like status of a group

This commit is contained in:
Pierre HUBERT 2020-07-10 10:37:02 +02:00
parent e62ea3c3ad
commit 6756eccf33

View File

@ -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!();