add: don't allow poll creator to vote
add: unfollow user when you block them add: force other user to unfollow you by blocking them add: leave receiver communities when you block them
This commit is contained in:
parent
5a330b7a18
commit
460e87e90e
11 changed files with 165 additions and 17 deletions
|
@ -292,6 +292,32 @@ impl DataManager {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete a membership given its `id`
|
||||
pub async fn delete_membership_force(&self, id: usize) -> Result<()> {
|
||||
let y = self.get_membership_by_id(id).await?;
|
||||
|
||||
let conn = match self.connect().await {
|
||||
Ok(c) => c,
|
||||
Err(e) => return Err(Error::DatabaseConnection(e.to_string())),
|
||||
};
|
||||
|
||||
let res = execute!(
|
||||
&conn,
|
||||
"DELETE FROM memberships WHERE id = $1",
|
||||
&[&(id as i64)]
|
||||
);
|
||||
|
||||
if let Err(e) = res {
|
||||
return Err(Error::DatabaseError(e.to_string()));
|
||||
}
|
||||
|
||||
self.2.remove(format!("atto.membership:{}", id)).await;
|
||||
|
||||
self.decr_community_member_count(y.community).await.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Update a membership's role given its `id`
|
||||
pub async fn update_membership_role(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue