<commit_before># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
# (c) <NAME>

class MsgsController < ApplicationController
  respond_to :html, :json
  def create
    @chatroom = Chatroom.find params[:chatroom_id]
    @msg      = @chatroom.msgs.build params[:msg]
    @msg.user = current_user
    @msg.save

    respond_to do |format|
      format.html { redirect_to @chatroom }
      format.js { render :nothing => true }
    end
  end

  def fetch
    @msgs = Msg.where "id > ? AND chatroom_id = ?", params[:msg_id], params[:chatroom_id]
    respond_with @msgs
  end
end
<commit_msg>Require authentication before posting a message<commit_after># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
# (c) <NAME>

class MsgsController < ApplicationController
  before_filter :authenticate_user!
  
  respond_to :html, :json
  def create
    @chatroom = Chatroom.find params[:chatroom_id]
    @msg      = @chatroom.msgs.build params[:msg]
    @msg.user = current_user
    @msg.save

    respond_to do |format|
      format.html { redirect_to @chatroom }
      format.js { render :nothing => true }
    end
  end

  def fetch
    @msgs = Msg.where "id > ? AND chatroom_id = ?", params[:msg_id], params[:chatroom_id]
    respond_with @msgs
  end
end

{'fraction_non_alphanumeric': 0.10253082414016872, 'fraction_numerical': 0.005191434133679429, 'mean_word_length': 3.2016348773841963, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '2344167', 'n_tokens_mistral': 514, 'n_tokens_neox': 498, 'n_words': 165}