<commit_before>require 'white_list_helper'

class FavouriteGroupsController < ApplicationController
  include WhiteListHelper
  
  before_filter :login_required
  before_filter :find_favourite_group, :only => [ :edit, :update, :destroy ]
  before_filter :set_no_layout, :only => [ :new, :edit ]
  
  protect_from_forgery :except => [:create, :update, :destroy]

  skip_before_filter :project_membership_required

  cache_sweeper :favourite_groups_sweeper, :only => [:update]
  
  def new
    @f_group = FavouriteGroup.new
    
    respond_to do |format|
      format.js # new_popup.html.erb
    end
  end
  
  def create
    group_name = white_list(params[:favourite_group_name])
    already_exists = FavouriteGroup.find(:first, :conditions => { :name => group_name, :user_id => current_user.id })
    
    unless already_exists
      # group doesn't exist - create a new one..
      new_group = FavouriteGroup.create( :name => group_name, :user_id => current_user.id )
      created = new_group.save
      
      if created
        # ..and add all members to it
        group_members = ActiveSupport::JSON.decode(white_list(params[:favourite_group_members]))
        group_members.each do |memb|
          person_id = memb[0].to_i<commit_msg>remove unneeded sweeper<commit_after>require 'white_list_helper'

class FavouriteGroupsController < ApplicationController
  include WhiteListHelper
  
  before_filter :login_required
  before_filter :find_favourite_group, :only => [ :edit, :update, :destroy ]
  before_filter :set_no_layout, :only => [ :new, :edit ]
  
  protect_from_forgery :except => [:create, :update, :destroy]

  skip_before_filter :project_membership_required

  def new
    @f_group = FavouriteGroup.new
    
    respond_to do |format|
      format.js # new_popup.html.erb
    end
  end
  
  def create
    group_name = white_list(params[:favourite_group_name])
    already_exists = FavouriteGroup.find(:first, :conditions => { :name => group_name, :user_id => current_user.id })
    
    unless already_exists
      # group doesn't exist - create a new one..
      new_group = FavouriteGroup.create( :name => group_name, :user_id => current_user.id )
      created = new_group.save
      
      if created
        # ..and add all members to it
        group_members = ActiveSupport::JSON.decode(white_list(params[:favourite_group_members]))
        group_members.each do |memb|
          person_id = memb[0].to_i
{'fraction_non_alphanumeric': 0.09707939119703826, 'fraction_numerical': 0.0008227067050596463, 'mean_word_length': 3.5800376647834273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '5661386', 'n_tokens_mistral': 796, 'n_tokens_neox': 769, 'n_words': 167}