merge method

bool merge(
  1. ReactionEvent event
)

Implementation

bool merge(ReactionEvent event) {
  if (updatedAt < event.updatedAt) {
    updatedAt = event.updatedAt;
  }

  final userUpdatedAt = updatedAts[event.userId] ?? 0;
  if (userUpdatedAt > event.updatedAt) {
    return false;
  }

  updatedAts[event.userId] = event.updatedAt;

  if (event.operation == ReactionEventAction.add) {
    userIds.add(event.userId);
  } else {
    userIds.remove(event.userId);
  }
  return true;
}