     @IBOutlet weak var imageView: UIImageView!
 
     private func userAvatarURL() -> URL? {
-        guard let username = user?.username else { return nil }
-        guard let auth = AuthManager.isAuthenticated() else { return nil }
-        guard let baseURL = auth.baseURL() else { return nil }
-        guard let encodedUsername = username.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) else { return nil }
+        guard
+            let user = user, !user.isInvalidated,
+            let username = user.username,
+            let auth = AuthManager.isAuthenticated(),
+            let baseURL = auth.baseURL(),
+            let encodedUsername = username.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)
+        else {
+            return nil
+        }
+
         return URL(string: "\(baseURL)/avatar/\(encodedUsername)")
     }
 

    }

    private func setAvatarWithInitials() {
        let username = self.user?.username ?? "?"

        var initials = ""
        var color: UInt = 0x000000



    var user: User? {
        didSet {
            updateAvatar()
        }
    }

