diff --git a/RestControllers/friendsController.php b/RestControllers/friendsController.php index 7d50d11..a312148 100644 --- a/RestControllers/friendsController.php +++ b/RestControllers/friendsController.php @@ -155,7 +155,6 @@ class friendsController{ "sent_request" => false, "received_request" => false, "following" => false, - "can_post_texts" => false, ); //Check if the two personns are friend @@ -180,10 +179,6 @@ class friendsController{ if(CS::get()->components->friends->is_following(userID, $friendID)) $response['following'] = true; - //Check if the user can post text on his friend page - if(CS::get()->components->friends->can_post_text(userID, $friendID)) - $response['can_post_texts'] = true; - } //Return the response diff --git a/RestControllers/userController.php b/RestControllers/userController.php index 4a61b08..e58687b 100644 --- a/RestControllers/userController.php +++ b/RestControllers/userController.php @@ -139,9 +139,19 @@ class userController //User friends won't be displayed $userInfos["number_friends"] = 0; + //User can not post text on this page by default + $userInfos["can_post_texts"] = FALSE; + //Get some informations only is user is signed in if(user_signed_in()){ $userInfos["user_like_page"] = CS::get()->components->likes->is_liking(userID, $userID, Likes::LIKE_USER); + + //Check if the user can post texts on this page + $userInfos["can_post_texts"] = + //If it is his page, yes by default + userID == $userID ? TRUE : + //Else check friendship status + CS::get()->components->friends->can_post_text(userID, $userID); } //Return user informations