only-last-30-days-notifications #331

Merged
philipp merged 7 commits from only-last-30-days-notifications into staging 2024-04-01 22:38:38 +02:00
2 changed files with 21 additions and 11 deletions
Showing only changes of commit 1caced26d6 - Show all commits

View File

@ -11,7 +11,7 @@ impl UserTrip {
user: &User,
trip_details: &TripDetails,
user_note: Option<String>,
) -> Result<(), UserTripError> {
) -> Result<String, UserTripError> {
if trip_details.is_full(db).await {
return Err(UserTripError::EventAlreadyFull);
}
@ -81,7 +81,7 @@ impl UserTrip {
.await;
}
Ok(())
Ok(name_newly_registered_person)
}
pub async fn delete(

View File

@ -63,15 +63,25 @@ async fn join(
};
match UserTrip::create(db, &user, &trip_details, user_note).await {
Ok(_) => {
Log::create(
db,
format!(
"User {} registered for trip_details.id={}",
user.name, trip_details_id
),
)
.await;
Ok(registered_user) => {
if registered_user == user.name {
Log::create(
db,
format!(
"User {} registered for trip_details.id={}",
user.name, trip_details_id
),
)
.await;
}else{
Log::create(
db,
format!(
"User {} registered the guest '{}' for trip_details.id={}",
user.name, registered_user, trip_details_id
),
).await;
}
Flash::success(Redirect::to("/planned"), "Erfolgreich angemeldet!")
}
Err(UserTripError::EventAlreadyFull) => {