<commit_before>require 'net/http/post/multipart'

class TicketService
    def self.send(ticket)
        text = ticket.format_body
        subject = ticket.format_subject
	ical = ticket.format_ical
        queue = ticket.rt_queue
        requestor = IDB.config.rt.requestor
        owner = "nobody"
        owner = ticket.maintenance_announcement.user.rtname if ticket.maintenance_announcement.user.rtname

        begin
          # create ticket
          ticket_id = TicketService.create_rt_ticket(queue, requestor, subject, text, owner)

          ticket.ticket_id = ticket_id

          # comment ticket to send announcement to real contact in bcc
          bcc = [ ticket.email ]
          TicketService.reply_rt_ticket(ticket_id, bcc, subject, text, ical)

	  # if we have an invitation_email, add another reply containing the ical-invitation
	  if ticket.invitation_email
              ical_invitation = ticket.format_ical true
	      TicketService.reply_rt_ticket(ticket_id, bcc, subject, text, ical_invitation)
	  end

          ticket.save!
        rescue Exception => e
          raise e
        end
    end
<commit_msg>send invitation to correct address<commit_after>require 'net/http/post/multipart'

class TicketService
    def self.send(ticket)
        text = ticket.format_body
        subject = ticket.format_subject
	ical = ticket.format_ical
        queue = ticket.rt_queue
        requestor = IDB.config.rt.requestor
        owner = "nobody"
        owner = ticket.maintenance_announcement.user.rtname if ticket.maintenance_announcement.user.rtname

        begin
          # create ticket
          ticket_id = TicketService.create_rt_ticket(queue, requestor, subject, text, owner)

          ticket.ticket_id = ticket_id

          # comment ticket to send announcement to real contact in bcc
          bcc = [ ticket.email ]
          TicketService.reply_rt_ticket(ticket_id, bcc, subject, text, ical)

	  # if we have an invitation_email, add another reply containing the ical-invitation
	  unless ticket.invitation_email.empty?
              ical_invitation = ticket.format_ical true
	      TicketService.reply_rt_ticket(ticket_id, [ ticket.invitation_email ], subject, text, ical_invitation)
	  end

          ticket.save!
        rescue Exception => e
          raise e
        end
    end

{'fraction_non_alphanumeric': 0.0651986183074266, 'fraction_numerical': 0.0, 'mean_word_length': 2.5701078582434516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3926068', 'n_tokens_mistral': 679, 'n_tokens_neox': 648, 'n_words': 164}