<commit_before>class MessagesController < ApplicationController

  before_filter :scope_recipient, except: [:index, :show, :destroy]
  before_action :require_login

  def index
    @conversations = current_user.conversations.sort_by(&:created_at).reverse.uniq
  end

  def new
    in_reply_to = params[:message_id] && current_user.messages.find(params[:message_id])
    @conversation = in_reply_to ? in_reply_to.conversation : Conversation.new
    @recipient = @conversation.other_participant(current_user)
    @recipient ||= User.find(params[:recipient_id]) if params[:recipient_id]
    @recipient ||= User.new<commit_msg>Message fix<commit_after>class MessagesController < ApplicationController

  before_filter :scope_recipient, except: [:index, :show, :destroy]
  before_action :require_login

  def index
    @conversations = current_user.conversations.sort_by(&:created_at).reverse.uniq
  end

  def new
    in_reply_to = params[:message_id] && current_user.messages.find(params[:message_id])
    if in_reply_to
      @conversation = in_reply_to.conversation
    else
      @recipient ||= User.find(params[:recipient_id]) if params[:recipient_id]
      @recipient ||= User.new
      @conversation = Conversation.new
      @conversation.participants << current_user
      @conversation.participants << @recipient
      @converation.save
    end
    @recipient = @conversation.other_participant(current_user)
{'fraction_non_alphanumeric': 0.10410764872521247, 'fraction_numerical': 0.0, 'mean_word_length': 4.962025316455696, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5435064', 'n_tokens_mistral': 460, 'n_tokens_neox': 436, 'n_words': 75}