add: 8 achievements add: larger text setting fix: small infinite

timeline bugs
This commit is contained in:
trisua 2025-06-27 13:10:04 -04:00
parent b860f74124
commit 5dd9fa01cb
19 changed files with 241 additions and 123 deletions

View file

@ -1,5 +1,5 @@
use oiseau::cache::Cache;
use crate::model::auth::FollowResult;
use crate::model::auth::{AchievementName, FollowResult};
use crate::model::requests::{ActionRequest, ActionType};
use crate::model::{Error, Result, auth::User, auth::UserFollow, permissions::FinePermission};
use crate::{auto_method, DataManager};
@ -238,9 +238,14 @@ impl DataManager {
/// # Arguments
/// * `data` - a mock [`UserFollow`] object to insert
/// * `force` - if we should skip the request stage
pub async fn create_userfollow(&self, data: UserFollow, force: bool) -> Result<FollowResult> {
pub async fn create_userfollow(
&self,
data: UserFollow,
initiator: &User,
force: bool,
) -> Result<FollowResult> {
if !force {
let other_user = self.get_user_by_id(data.receiver).await?;
let mut other_user = self.get_user_by_id(data.receiver).await?;
if other_user.settings.private_profile {
// send follow request instead
@ -254,6 +259,12 @@ impl DataManager {
return Ok(FollowResult::Requested);
}
// check if we're staff
if initiator.permissions.check(FinePermission::STAFF_BADGE) {
self.add_achievement(&mut other_user, AchievementName::FollowedByStaff.into())
.await?;
}
}
// ...