<commit_before>class NotificationEventCreate < NotificationSender
  #new events
  def perform(event_id)
    event = Event.find(event_id)
    @trackable = event
    user = event.user
    organizer = event.groups.first
    if organizer #if there is a group  #todo there are some problems with private and public events and their notifications (???)
      data = {event_id: event.id,
              group: organizer.name,
              group_id: organizer.id,
              user_id: user.id,
              event: event.title}
      data[:subdomain] = organizer.subdomain if organizer.certified?

      notification_a = Notification.create(notification_type_id: NotificationType::NEW_EVENTS, url: event_url(event), data: data)

      organizer.participants.each do |receiver|
        send_notification_to_user(notification_a, receiver) unless receiver == user #send an alert to everybody except the one which created the event
      end
    else
      data = {event_id: event.id, event: event.title, user_id: user.id}
      notification_a = Notification.create(notification_type_id: NotificationType::NEW_PUBLIC_EVENTS, url: event_url(event), data: data)
      User.non_blocking_notification(NotificationType::NEW_PUBLIC_EVENTS).each do |receiver|
        send_notification_to_user(notification_a, user) unless receiver == user
      end
    end
  end
end
<commit_msg>fix issue #1434<commit_after>class NotificationEventCreate < NotificationSender
  #new events
  def perform(event_id)
    event = Event.find(event_id)
    @trackable = event
    user = event.user
    organizer = event.groups.first

    if organizer # if there is a group
      data = {event_id: event.id,
              group: organizer.name,
              group_id: organizer.id,
              user_id: user.id,
              event: event.title}
      data[:subdomain] = organizer.subdomain if organizer.certified?

      notification_a = Notification.create(notification_type_id: NotificationType::NEW_EVENTS,
                                           url: group_event_url(organizer, event),
                                           data: data)

      # send an alert to everybody except the one which created the event
      organizer.participants.each do |receiver|
        send_notification_to_user(notification_a, receiver) unless receiver == user
      end
    else  # public Airesis events
      data = {event_id: event.id, event: event.title, user_id: user.id}
      notification_a = Notification.create(notification_type_id: NotificationType::NEW_PUBLIC_EVENTS,
                                           url: event_url(event),
                                           data: data)
      User.non_blocking_notification(NotificationType::NEW_PUBLIC_EVENTS).each do |receiver|
        send_notification_to_user(notification_a, user) unless receiver == user
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07520111927247289, 'fraction_numerical': 0.0013990905911157748, 'mean_word_length': 2.6808236808236807, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1997514', 'n_tokens_mistral': 791, 'n_tokens_neox': 752, 'n_words': 203}