def send_email_to(recipient, user_role:)
      return unless recipient
      return unless recipient.email_on_notification?

      NotificationMailer
        .event_received(
          event,
          event_class.name,
          resource,
          recipient,
          user_role.to_s,
          extra
        )
        .deliver_later
    end
def send_email_to(recipient, user_role:)
      return unless recipient
      return unless recipient.email_on_notification?

      NotificationMailer
        .event_received(
          event,
          event_class.name,
          resource,
          recipient,
          user_role.to_s,
          extra
        )
        .deliver_later
    end
Private: sends the notification email to the user if they have the
 `email_on_notification` flag active.

 recipient - The user that will receive the email.
 user_role - the role the user takes for this notification (either
   `:follower` or `:affected_user`)

 Returns nothing.