Compare commits
	
		
			2 Commits
		
	
	
		
			1db09cd8ac
			...
			4da996251a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4da996251a | |||
| aa9568f326 | 
@@ -288,23 +288,28 @@ 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, &user.0).await {
 | 
					    match logbook.update(db, data.clone(), &user.0).await {
 | 
				
			||||||
        Ok(()) => Flash::success(
 | 
					        Ok(()) => {
 | 
				
			||||||
            Redirect::to("/log/show"),
 | 
					            Log::create(
 | 
				
			||||||
            format!("Logbucheintrag erfolgreich bearbeitet"),
 | 
					                db,
 | 
				
			||||||
        ),
 | 
					                format!(
 | 
				
			||||||
 | 
					                    "User {} updated log entry={:?} to {:?}",
 | 
				
			||||||
 | 
					                    &user.name, logbook, data
 | 
				
			||||||
 | 
					                ),
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					            .await;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Flash::success(
 | 
				
			||||||
 | 
					                Redirect::to("/log/show"),
 | 
				
			||||||
 | 
					                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!"),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user