add: 8 more achievements
This commit is contained in:
parent
8d70f65863
commit
a799c777ea
11 changed files with 121 additions and 18 deletions
|
@ -1,4 +1,5 @@
|
|||
use oiseau::cache::Cache;
|
||||
use crate::model::auth::AchievementName;
|
||||
use crate::model::communities::Community;
|
||||
use crate::model::requests::{ActionRequest, ActionType};
|
||||
use crate::model::{
|
||||
|
@ -169,7 +170,11 @@ impl DataManager {
|
|||
/// # Arguments
|
||||
/// * `data` - a mock [`CommunityMembership`] object to insert
|
||||
#[async_recursion::async_recursion]
|
||||
pub async fn create_membership(&self, data: CommunityMembership) -> Result<String> {
|
||||
pub async fn create_membership(
|
||||
&self,
|
||||
data: CommunityMembership,
|
||||
user: &User,
|
||||
) -> Result<String> {
|
||||
// make sure membership doesn't already exist
|
||||
if self
|
||||
.get_membership_by_owner_community_no_void(data.owner, data.community)
|
||||
|
@ -199,7 +204,7 @@ impl DataManager {
|
|||
.await?;
|
||||
|
||||
// ...
|
||||
return self.create_membership(data).await;
|
||||
return self.create_membership(data, user).await;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
|
@ -237,6 +242,9 @@ impl DataManager {
|
|||
Ok(if data.role.check(CommunityPermission::REQUESTED) {
|
||||
"Join request sent".to_string()
|
||||
} else {
|
||||
self.add_achievement(&mut user.clone(), AchievementName::JoinCommunity.into())
|
||||
.await?;
|
||||
|
||||
"Community joined".to_string()
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue