not so much clutter when addding notes
This commit is contained in:
@@ -17,11 +17,14 @@ pub struct Activity {
|
||||
pub keep_until: Option<NaiveDateTime>,
|
||||
}
|
||||
|
||||
// TODO: add `reason` as additional db field, to be able to query and show this to the users
|
||||
pub enum Reason<'a> {
|
||||
// `User` tried to login with `String` as UserAgent
|
||||
SuccLogin(&'a User, String),
|
||||
// `User` changed the data of `User`, explanation in `String`
|
||||
UserDataChange(&'a ManageUserUser, &'a User, String),
|
||||
// New Note for User
|
||||
NewUserNote(&'a ManageUserUser, &'a User, String),
|
||||
}
|
||||
|
||||
impl From<Reason<'_>> for ActivityBuilder {
|
||||
@@ -36,6 +39,9 @@ impl From<Reason<'_>> for ActivityBuilder {
|
||||
"{changed_by} hat die Daten von {changed_user} aktualisiert: {explanation}"
|
||||
))
|
||||
.relevant_for_user(changed_user),
|
||||
Reason::NewUserNote(changed_by, user, explanation) => {
|
||||
Self::new(&format!("({changed_by}) {explanation}")).relevant_for_user(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user