Compare commits
No commits in common. "c44c0d8505431cf75bb9aef5214acc2ecd38618e" and "59ef93d6fac5efbe5b7dc9a737144e4f58b561d0" have entirely different histories.
c44c0d8505
...
59ef93d6fa
@ -288,28 +288,23 @@ async fn update(
|
||||
data: Form<LogToUpdate>,
|
||||
user: VorstandUser,
|
||||
) -> Flash<Redirect> {
|
||||
Log::create(
|
||||
db,
|
||||
format!("User {} tries to update log entry={:?}", &user.name, data),
|
||||
)
|
||||
.await;
|
||||
|
||||
let data = data.into_inner();
|
||||
|
||||
let Some(logbook) = Logbook::find_by_id(db, data.id).await else {
|
||||
return Flash::error(Redirect::to("/log"), &format!("Logbucheintrag kann nicht bearbeitet werden, da es einen Logbuch-Eintrag mit ID={} nicht gibt", data.id));
|
||||
};
|
||||
|
||||
match logbook.update(db, data.clone(), &user.0).await {
|
||||
Ok(()) => {
|
||||
Log::create(
|
||||
db,
|
||||
format!(
|
||||
"User {} updated log entry={:?} to {:?}",
|
||||
&user.name, logbook, data
|
||||
),
|
||||
)
|
||||
.await;
|
||||
|
||||
Flash::success(
|
||||
match logbook.update(db, data, &user.0).await {
|
||||
Ok(()) => Flash::success(
|
||||
Redirect::to("/log/show"),
|
||||
format!("Logbucheintrag erfolgreich bearbeitet"),
|
||||
)
|
||||
}
|
||||
),
|
||||
Err(LogbookAdminUpdateError::NotAllowed) => Flash::error(
|
||||
Redirect::to("/log/show"),
|
||||
format!("Du hast keine Erlaubnis, diesen Logbucheintrag zu bearbeiten!"),
|
||||
|
Loading…
Reference in New Issue
Block a user