Prevent setting zero user last login

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga 2025-01-03 17:55:35 +03:00
parent 34d26d44b0
commit ca40247b15
No known key found for this signature in database
GPG Key ID: 511EED5C928AD547

View File

@ -886,6 +886,10 @@ func (s *SqlStore) GetAccountSettings(ctx context.Context, lockStrength LockingS
// SaveUserLastLogin stores the last login time for a user in DB. // SaveUserLastLogin stores the last login time for a user in DB.
func (s *SqlStore) SaveUserLastLogin(ctx context.Context, accountID, userID string, lastLogin time.Time) error { func (s *SqlStore) SaveUserLastLogin(ctx context.Context, accountID, userID string, lastLogin time.Time) error {
if lastLogin.IsZero() {
return nil
}
var user types.User var user types.User
result := s.db.First(&user, accountAndIDQueryCondition, accountID, userID) result := s.db.First(&user, accountAndIDQueryCondition, accountID, userID)
if result.Error != nil { if result.Error != nil {