Compare commits
No commits in common. "4da996251a3352498e45328c3b6cd67353db2b12" and "1db09cd8accc5015d2a8641f60840811c589558f" have entirely different histories.
4da996251a
...
1db09cd8ac
@ -288,28 +288,23 @@ async fn update(
|
|||||||
data: Form<LogToUpdate>,
|
data: Form<LogToUpdate>,
|
||||||
user: VorstandUser,
|
user: VorstandUser,
|
||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
|
Log::create(
|
||||||
|
db,
|
||||||
|
format!("User {} tries to update log entry={:?}", &user.name, data),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
let data = data.into_inner();
|
let data = data.into_inner();
|
||||||
|
|
||||||
let Some(logbook) = Logbook::find_by_id(db, data.id).await else {
|
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));
|
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 {
|
match logbook.update(db, data, &user.0).await {
|
||||||
Ok(()) => {
|
Ok(()) => Flash::success(
|
||||||
Log::create(
|
|
||||||
db,
|
|
||||||
format!(
|
|
||||||
"User {} updated log entry={:?} to {:?}",
|
|
||||||
&user.name, logbook, data
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Flash::success(
|
|
||||||
Redirect::to("/log/show"),
|
Redirect::to("/log/show"),
|
||||||
format!("Logbucheintrag erfolgreich bearbeitet"),
|
format!("Logbucheintrag erfolgreich bearbeitet"),
|
||||||
)
|
),
|
||||||
}
|
|
||||||
Err(LogbookAdminUpdateError::NotAllowed) => Flash::error(
|
Err(LogbookAdminUpdateError::NotAllowed) => Flash::error(
|
||||||
Redirect::to("/log/show"),
|
Redirect::to("/log/show"),
|
||||||
format!("Du hast keine Erlaubnis, diesen Logbucheintrag zu bearbeiten!"),
|
format!("Du hast keine Erlaubnis, diesen Logbucheintrag zu bearbeiten!"),
|
||||||
|
Loading…
Reference in New Issue
Block a user