add: dedicated responses tab for profiles

This commit is contained in:
trisua 2025-07-06 13:34:20 -04:00
parent 9ba6320d46
commit 07a23f505b
24 changed files with 332 additions and 55 deletions

View file

@ -1,6 +1,8 @@
use super::common::NAME_REGEX;
use oiseau::cache::Cache;
use crate::model::auth::{Achievement, AchievementRarity, Notification, UserConnections};
use crate::model::auth::{
Achievement, AchievementName, AchievementRarity, Notification, UserConnections, ACHIEVEMENTS,
};
use crate::model::moderation::AuditLogEntry;
use crate::model::oauth::AuthGrant;
use crate::model::permissions::SecondaryPermission;
@ -764,7 +766,13 @@ impl DataManager {
/// Add an achievement to a user.
///
/// Still returns `Ok` if the user already has the achievement.
pub async fn add_achievement(&self, user: &mut User, achievement: Achievement) -> Result<()> {
#[async_recursion::async_recursion]
pub async fn add_achievement(
&self,
user: &mut User,
achievement: Achievement,
check_for_final: bool,
) -> Result<()> {
if user.settings.disable_achievements {
return Ok(());
}
@ -794,6 +802,15 @@ impl DataManager {
self.update_user_achievements(user.id, user.achievements.to_owned())
.await?;
// check for final
if check_for_final {
if user.achievements.len() + 1 == ACHIEVEMENTS {
self.add_achievement(user, AchievementName::GetAllOtherAchievements.into(), false)
.await?;
}
}
// ...
Ok(())
}