<commit_before>class NotificationsController < ApplicationController
  include NotificationsHelper
  before_action :authenticate_member!
  load_and_authorize_resource
  respond_to :html

  # GET /notifications
  def index
    @notifications = Notification.by_recipient(current_member).page(params[:page])
  end

  # GET /notifications/1
  def show
    @notification.read = true
    @notification.save
    @reply_link = reply_link(@notification)
  end

  # GET /notifications/new

  def new
    @notification = Notification.new
    @recipient = Member.find_by(id: params[:recipient_id])
    @subject   = params[:subject] || ""
  end

  # GET /notifications/1/reply
  def reply
    @notification = Notification.new
    @sender_notification = Notification.find(params[:id])
    @sender_notification.read = true
    @sender_notification.save
    @recipient = @sender_notification.sender
    @subject   = @sender_notification.subject =~ /^Re: / ?
      @sender_notification.subject :
      "Re: " + @sender_notification.subject
  end

  # DELETE /notifications/1
  def destroy
    @notification.destroy
    redirect_to notifications_url
  end<commit_msg>You can only reply to messages that were sent to you.<commit_after>class NotificationsController < ApplicationController
  include NotificationsHelper
  before_action :authenticate_member!
  load_and_authorize_resource
  respond_to :html

  # GET /notifications
  def index
    @notifications = Notification.by_recipient(current_member).page(params[:page])
  end

  # GET /notifications/1
  def show
    @notification.read = true
    @notification.save
    @reply_link = reply_link(@notification)
  end

  # GET /notifications/new

  def new
    @notification = Notification.new
    @recipient = Member.find_by(id: params[:recipient_id])
    @subject   = params[:subject] || ""
  end

  # GET /notifications/1/reply
  def reply
    @notification = Notification.new
    @sender_notification = Notification.find_by(id: params[:id], recipient: current_member)
    @sender_notification.read = true
    @sender_notification.save
    @recipient = @sender_notification.sender
    @subject   = @sender_notification.subject =~ /^Re: / ?
      @sender_notification.subject :
      "Re: " + @sender_notification.subject
  end

  # DELETE /notifications/1
  def destroy
    @notification.destroy
    redirect_to notifications_url
  end
{'fraction_non_alphanumeric': 0.09106239460370995, 'fraction_numerical': 0.002529510961214165, 'mean_word_length': 3.8329938900203664, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7476262', 'n_tokens_mistral': 713, 'n_tokens_neox': 680, 'n_words': 146}