<commit_before>class NotificationsController < ApplicationController
  def index
    notifications = current_user.notifications.order("created_at DESC").
      includes(:event => Events::Base.activity_stream_eager_load_associations).
      includes(:recipient, :comment)
    notifications = notifications.unread if params['type'] == 'unread'
    # PT:SCOPE Filter results by scope for current user

    if notifications.count != 0
      notifications = Notification.filter_by_scope(current_user, notifications) if current_user_in_scope?
    end

    present paginate(notifications), :presenter_options => {:activity_stream => true, :succinct => true, :cached => true}
  end

  def read
    current_user.notifications.where(:id => params[:notification_ids]).update_all(:read => true)
    head :ok
  end

  def destroy
    notification = Notification.find(params[:id])
    Authority.authorize! :destroy, notification, current_user, { :or => :current_user_is_object_recipient }
    notification.destroy
    render :json => {}
  end
end<commit_msg>add namespace to cache for notifications<commit_after>class NotificationsController < ApplicationController
  def index
    notifications = current_user.notifications.order("created_at DESC").
      includes(:event => Events::Base.activity_stream_eager_load_associations).
      includes(:recipient, :comment)
    notifications = notifications.unread if params['type'] == 'unread'
    # PT:SCOPE Filter results by scope for current user

    if notifications.count != 0
      notifications = Notification.filter_by_scope(current_user, notifications) if current_user_in_scope?
    end

    present paginate(notifications), :presenter_options => {:activity_stream => true, :succinct => true, :cached => true, :namespace => "notifications"}
  end

  def read
    current_user.notifications.where(:id => params[:notification_ids]).update_all(:read => true)
    head :ok
  end

  def destroy
    notification = Notification.find(params[:id])
    Authority.authorize! :destroy, notification, current_user, { :or => :current_user_is_object_recipient }
    notification.destroy
    render :json => {}
  end
end
{'fraction_non_alphanumeric': 0.10344827586206896, 'fraction_numerical': 0.0009319664492078285, 'mean_word_length': 4.7560321715817695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '7578474', 'n_tokens_mistral': 610, 'n_tokens_neox': 580, 'n_words': 140}