fix ci; nicer explanation; subpages
This commit is contained in:
@@ -11,17 +11,20 @@ use crate::model::{notification::Notification, user::User};
|
||||
async fn mark_read(db: &State<SqlitePool>, user: User, notification_id: i64) -> Flash<Redirect> {
|
||||
let Some(notification) = Notification::find_by_id(db, notification_id).await else {
|
||||
return Flash::error(
|
||||
Redirect::to("/"),
|
||||
Redirect::to("/notifications"),
|
||||
format!("Nachricht mit ID {notification_id} nicht gefunden."),
|
||||
);
|
||||
};
|
||||
|
||||
if notification.user_id == user.id {
|
||||
notification.mark_read(db).await;
|
||||
Flash::success(Redirect::to("/"), "Nachricht als gelesen markiert")
|
||||
Flash::success(
|
||||
Redirect::to("/notifications"),
|
||||
"Nachricht als gelesen markiert",
|
||||
)
|
||||
} else {
|
||||
Flash::success(
|
||||
Redirect::to("/"),
|
||||
Redirect::to("/notifications"),
|
||||
"Du kannst fremde Nachrichten nicht als gelesen markieren.",
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user