Browse Source

Make `User`'s equality depend on its `UserID`

pull/13/head
Anton Tarasenko 2 years ago
parent
commit
fec8535c0f
  1. 16
      sources/Users/User.uc

16
sources/Users/User.uc

@ -176,6 +176,22 @@ public final function bool SetPersistentData(
return result; return result;
} }
public function bool IsEqual(Object other) {
local User otherUser;
if (id == none) return false;
otherUser = User(other);
if (otherUser == none) return false;
if (otherUser.id == none) return false;
return id.IsEqual(otherUser.id);
}
protected function int CalculateHashCode() {
// If `id` is `none`, then caller `User` shouldn't be used at all
return id.GetHashCode();
}
defaultproperties defaultproperties
{ {
} }
Loading…
Cancel
Save