<commit_before>require 'pavlov'
require_relative '../util/mixpanel'

module Interactors
  class ReplyToConversation
    include Pavlov::Interactor
    include Util::Mixpanel

    arguments :conversation_id, :sender_id, :content

    def execute
      conversation = Conversation.find(@conversation_id)
      message = command :create_message, @sender_id, @content, conversation

      sender = User.find(@sender_id)
      command :create_activity, sender.graph_user, :replied_message, message, nil

      track_mixpanel

      message
    end

    def track_mixpanel
      mp_increment_person_property :replies_created
      mp_track :reply_created
      mp_track "Conversation: Replied to conversation",
    end

    def authorized?
      #relay authorization to commands, only require a user to check
      @options[:current_user].id.to_s == @sender_id.to_s
    end
  end
end
<commit_msg>Added conversation ID as property for reply_created<commit_after>require 'pavlov'
require_relative '../util/mixpanel'

module Interactors
  class ReplyToConversation
    include Pavlov::Interactor
    include Util::Mixpanel

    arguments :conversation_id, :sender_id, :content

    def execute
      conversation = Conversation.find(@conversation_id)
      message = command :create_message, @sender_id, @content, conversation

      sender = User.find(@sender_id)
      command :create_activity, sender.graph_user, :replied_message, message, nil

      track_mixpanel

      message
    end

    def track_mixpanel
      mp_increment_person_property :replies_created
      mp_track "Conversation: Replied to conversation",
        conversation_id: @conversation_id
    end

    def authorized?
      #relay authorization to commands, only require a user to check
      @options[:current_user].id.to_s == @sender_id.to_s
    end
  end
end

{'fraction_non_alphanumeric': 0.06939890710382514, 'fraction_numerical': 0.0, 'mean_word_length': 3.6120906801007555, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7586830', 'n_tokens_mistral': 533, 'n_tokens_neox': 521, 'n_words': 138}