only-last-30-days-notifications #331
@ -11,7 +11,7 @@ impl UserTrip {
|
|||||||
user: &User,
|
user: &User,
|
||||||
trip_details: &TripDetails,
|
trip_details: &TripDetails,
|
||||||
user_note: Option<String>,
|
user_note: Option<String>,
|
||||||
) -> Result<(), UserTripError> {
|
) -> Result<String, UserTripError> {
|
||||||
if trip_details.is_full(db).await {
|
if trip_details.is_full(db).await {
|
||||||
return Err(UserTripError::EventAlreadyFull);
|
return Err(UserTripError::EventAlreadyFull);
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ impl UserTrip {
|
|||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(name_newly_registered_person)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete(
|
pub async fn delete(
|
||||||
|
@ -63,15 +63,25 @@ async fn join(
|
|||||||
};
|
};
|
||||||
|
|
||||||
match UserTrip::create(db, &user, &trip_details, user_note).await {
|
match UserTrip::create(db, &user, &trip_details, user_note).await {
|
||||||
Ok(_) => {
|
Ok(registered_user) => {
|
||||||
Log::create(
|
if registered_user == user.name {
|
||||||
db,
|
Log::create(
|
||||||
format!(
|
db,
|
||||||
"User {} registered for trip_details.id={}",
|
format!(
|
||||||
user.name, trip_details_id
|
"User {} registered for trip_details.id={}",
|
||||||
),
|
user.name, trip_details_id
|
||||||
)
|
),
|
||||||
.await;
|
)
|
||||||
|
.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!")
|
Flash::success(Redirect::to("/planned"), "Erfolgreich angemeldet!")
|
||||||
}
|
}
|
||||||
Err(UserTripError::EventAlreadyFull) => {
|
Err(UserTripError::EventAlreadyFull) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user