app/services/news_feed.rb
# Regenerate the user's feed from scratch.
Regenerate the user's feed from scratch.
Regenerate the user ' s feed from scratch .
def regenerate_feed!
    user_set = active_followed_users + [@user.id]
    group_set = active_joined_groups.to_a
    stories = Story.for_user(@user)
                   .order('stories.updated_at DESC')
                   .where('(stories.user_id IN (?) AND stories.group_id IS NULL) OR stories.group_id IN (?)', user_set, group_set)
                   .preload(:target)
                   .limit(FRESH_FETCH_SIZE)
    stories = stories.unbanned unless @user.ninja_banned?
    stories.each {|story| add! story }
  end
def regenerate_feed! user_set = active_followed_users + [ @user . id ] group_set = active_joined_groups . to_a stories = Story . for_user ( @user ) . order ( 'stories.updated_at DESC' ) . where ( '(stories.user_id IN (?) AND stories.group_id IS NULL) OR stories.group_id IN (?)' , user_set , group_set ) . preload ( :target ) . limit ( FRESH_FETCH_SIZE ) stories = stories . unbanned unless @user . ninja_banned? stories . each { | story | add! story } end
Regenerate the user's feed from scratch.
Regenerate the user ' s feed from scratch .