diff --git a/src/controllers/groups_controller.rs b/src/controllers/groups_controller.rs index 55bf808..469ecc1 100644 --- a/src/controllers/groups_controller.rs +++ b/src/controllers/groups_controller.rs @@ -352,4 +352,14 @@ pub fn remove_membership(r: &mut HttpRequestHandler) -> RequestResult { // TODO : delete group membership notifications r.success("Your membership has been successfully deleted!") +} + +/// Update following status over a group +pub fn set_following(r: &mut HttpRequestHandler) -> RequestResult { + let group_id = r.post_group_id_with_access("groupID", GroupAccessLevel::MEMBER_ACCESS)?; + let following = r.post_bool("follow")?; + + groups_helper::set_following(&group_id, &r.user_id()?, following)?; + + r.success("Following status updated.") } \ No newline at end of file diff --git a/src/controllers/routes.rs b/src/controllers/routes.rs index 34be1da..9e2341a 100644 --- a/src/controllers/routes.rs +++ b/src/controllers/routes.rs @@ -170,6 +170,8 @@ pub fn get_routes() -> Vec { Route::post("/groups/remove_membership", Box::new(groups_controller::remove_membership)), + Route::post("/groups/set_following", Box::new(groups_controller::set_following)), + // Virtual directory controller Route::post("/user/findbyfolder", Box::new(virtual_directory_controller::find_user)),