don't clutter acitvities toooooo much

This commit is contained in:
Philipp Hofer 2025-05-05 22:23:28 +02:00
parent 6098aedb74
commit 3b5ff70d1d
2 changed files with 9 additions and 13 deletions

View File

@ -577,10 +577,6 @@ ASKÖ Ruderverein Donau Linz", self.name),
.execute(db) .execute(db)
.await .await
.unwrap(); //Okay, because we can only create a User of a valid id .unwrap(); //Okay, because we can only create a User of a valid id
ActivityBuilder::new(&format!("User {self} hat sich eingeloggt."))
.relevant_for_user(self)
.save(db)
.await;
} }
pub async fn delete(&self, db: &SqlitePool, deleted_by: &ManageUserUser) { pub async fn delete(&self, db: &SqlitePool, deleted_by: &ManageUserUser) {

View File

@ -1,5 +1,4 @@
use rocket::{ use rocket::{
FromForm, Request, Route, State,
form::Form, form::Form,
get, get,
http::{Cookie, CookieJar}, http::{Cookie, CookieJar},
@ -9,11 +8,13 @@ use rocket::{
response::{Flash, Redirect}, response::{Flash, Redirect},
routes, routes,
time::{Duration, OffsetDateTime}, time::{Duration, OffsetDateTime},
FromForm, Request, Route, State,
}; };
use rocket_dyn_templates::{Template, context, tera}; use rocket_dyn_templates::{context, tera, Template};
use sqlx::SqlitePool; use sqlx::SqlitePool;
use crate::model::{ use crate::model::{
activity::ActivityBuilder,
log::Log, log::Log,
user::{LoginError, User}, user::{LoginError, User},
}; };
@ -82,13 +83,12 @@ async fn login(
cookies.add_private(Cookie::new("loggedin_user", format!("{}", user.id))); cookies.add_private(Cookie::new("loggedin_user", format!("{}", user.id)));
Log::create( ActivityBuilder::new(&format!(
db, "{user} hat sich eingeloggt (User-Agent: {})",
format!( agent.0
"Succ login of {} with this useragent: {}", ))
login.name, agent.0 .relevant_for_user(&user)
), .save(db)
)
.await; .await;
// Check for redirect_url cookie and redirect accordingly // Check for redirect_url cookie and redirect accordingly