1
0

feat(notify): don't notify disabled users

This commit is contained in:
kolaente
2023-09-04 14:23:56 +02:00
parent c28d1af877
commit 80b40bb2c0
3 changed files with 84 additions and 28 deletions

View File

@ -137,6 +137,17 @@ func (u *User) RouteForDB() int64 {
return u.ID
}
func (u *User) ShouldNotify() (bool, error) {
s := db.NewSession()
defer s.Close()
user, err := getUser(s, &User{ID: u.ID}, true)
if err != nil {
return false, err
}
return user.Status != StatusDisabled, err
}
// GetID implements the Auth interface
func (u *User) GetID() int64 {
return u.ID