def update_event_visibility(review):
    """
    Update event's `is_published` flag according to review

    :param review: EventReview object
    :return: event review updated object
    """
    review.event.is_published = False
    if review.is_approved:
        review.event.is_published = True

    review.event.save()
    return review