mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-12-27 22:18:51 +00:00
Update can_post_texts parameter
This commit is contained in:
parent
b15ffe0856
commit
d195979c18
@ -137,4 +137,14 @@ pub fn set_following(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
friends_helper::set_following(r.user_id_ref()?, &friend_id, follow)?;
|
||||
|
||||
r.success("Following status updated!")
|
||||
}
|
||||
|
||||
/// Update post texts authorization status
|
||||
pub fn set_can_post_texts(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let friend_id = r.post_friend_id("friendID")?;
|
||||
let allow = r.post_bool("allow")?;
|
||||
|
||||
friends_helper::set_can_post_texts(r.user_id_ref()?, &friend_id, allow)?;
|
||||
|
||||
r.success("Updated status!")
|
||||
}
|
@ -107,6 +107,8 @@ pub fn get_routes() -> Vec<Route> {
|
||||
|
||||
Route::post("/friends/setFollowing", Box::new(friends_controller::set_following)),
|
||||
|
||||
Route::post("/friends/set_can_post_texts", Box::new(friends_controller::set_can_post_texts)),
|
||||
|
||||
|
||||
// Conversations controller
|
||||
Route::post("/conversations/create", Box::new(conversations_controller::create)),
|
||||
|
@ -172,6 +172,15 @@ pub fn set_following(user_id: &UserID, friend_id: &UserID, follow: bool) -> Resu
|
||||
.exec()
|
||||
}
|
||||
|
||||
/// Specify whether a friend is allowed to create posts on current user's page or not
|
||||
pub fn set_can_post_texts(user_id: &UserID, friend_id: &UserID, allow: bool) -> ResultBoxError {
|
||||
database::UpdateInfo::new(FRIENDS_TABLE)
|
||||
.cond_user_id("ID_personne", user_id)
|
||||
.cond_user_id("ID_amis", friend_id)
|
||||
.set_legacy_bool("autoriser_post_page", allow)
|
||||
.exec()
|
||||
}
|
||||
|
||||
/// Get the status of a friendship
|
||||
pub fn get_status(user_id: &UserID, friend_id: &UserID) -> ResultBoxError<FriendshipStatus> {
|
||||
let mut status = FriendshipStatus {
|
||||
|
Loading…
Reference in New Issue
Block a user