Fill acitivites from various activities; Fixes #972

This commit is contained in:
2025-05-04 18:38:14 +02:00
parent 8777ccb341
commit e853381bd7
12 changed files with 349 additions and 258 deletions

View File

@@ -1,6 +1,7 @@
use super::scheckbuch::ScheckbuchUser;
use super::schnupperant::SchnupperantUser;
use super::{ManageUserUser, User};
use crate::model::activity::ActivityBuilder;
use crate::model::role::Role;
use crate::{model::notification::Notification, special_user};
use rocket::async_trait;
@@ -25,7 +26,7 @@ impl SchnupperInterestUser {
self.user.add_role(db, changed_by, &scheckbook).await?;
let scheckbook = ScheckbuchUser::new(db, &self.user).await.unwrap();
scheckbook.send_welcome_mail_to_user(db, smtp_pw).await?;
scheckbook.notify(db, smtp_pw).await?;
Notification::create_for_steering_people(
db,
@@ -39,6 +40,13 @@ impl SchnupperInterestUser {
)
.await;
ActivityBuilder::new(&format!(
"Der Schnupperinteressierte {self} hat sich (ohne Schnupperkurs) doch gleich direkt für ein Scheckbuch entschieden. {changed_by} hat dieses eingerichtet."
))
.relevant_for_user(&self)
.save(db)
.await;
Ok(())
}
@@ -74,6 +82,12 @@ impl SchnupperInterestUser {
)
.await;
}
ActivityBuilder::new(&format!(
"Der Schnupperinteressierte {self} hat sich zum Schnupperkurs angemeldet."
))
.relevant_for_user(&self)
.save(db)
.await;
Ok(())
}
@@ -81,6 +95,13 @@ impl SchnupperInterestUser {
pub(crate) async fn notify(&self, db: &SqlitePool) -> Result<(), String> {
self.notify_schnupperbetreuer_about_new_interest(db).await;
ActivityBuilder::new(&format!(
"Der Schnupperbetreuer hat eine Info via Notification bekommen, dass {self} Interesse an einen Schnupperkurs hat."
))
.relevant_for_user(&self)
.save(db)
.await;
Ok(())
}