 
   getNewItemsCount: (callback) ->
     callback? @listController?.activityHeader?.getNewItemsCount() or 0
+
+  continueLoadingTeasers:->
+    log "continueLoadingTeasers"
+
+    # fix me
+    # this is a monkeypatch
+    # find the original problem and get rid of @continueLoadingTeasersLastTimeStamp
+    # and isNaN - SY
+    lastTimeStamp = @lastFrom
+    if isNaN(lastTimeStamp) or @continueLoadingTeasersLastTimeStamp is lastTimeStamp
+      @listController.hideLazyLoader()
+      return
+
+    @continueLoadingTeasersLastTimeStamp = lastTimeStamp
+    @populateActivity {to: lastTimeStamp}
+
+  sanitizeCache:(cache, callback)->
+    activities = clearQuotes cache.activities
+
+    KD.remote.reviveFromSnapshots activities, (err, instances)->
+      for activity,i in activities
+        cache.activities[activity._id] or= {}
+        cache.activities[activity._id].teaser = instances[i]
+
+      callback null, cache
+
+  # Store first & last cache activity timestamp.
+  extractCacheTimeStamps: (cache)->
+    @lastTo   = (new Date cache.to).getTime()
+    @lastFrom = (new Date cache.from).getTime()
+
+  # Refreshes activity feed, used when user has been disconnected
+  # for so long, backend connection is long gone.
+  #refresh:->
+    ## prevents multiple clicks to refresh from interfering
+    #return  if @isLoading
+
+    #@resetAll()
+
+  # Store first & last activity timestamp.
+  #extractTeasersTimeStamps:(teasers)->
+    #@lastTo   = teasers.first.meta.createdAt
+    #@lastFrom = teasers.last.meta.createdAt
+
+  #populateActivityWithTimeout:->
+    #@populateActivity {},\
+      #KD.utils.getTimedOutCallbackOne
+        #name      : "populateActivity",
+        #onSuccess : -> KD.logToMixpanel "refresh activity feed success"
+        #onTimeout : @recover.bind this
+
+  #recover:->
+
+    #KD.logToMixpanel "activity feed render failed; recovering"
+
+    #@isLoading = no
+    #@status.reconnect()
+
+  ## Fetches activities that occured after the first entry in user feed,
+  ## used for minor disruptions.
+  #fetchSomeActivities:(options = {}) ->
+    #return if @isLoading
+    #@isLoading = yes
+
+    #lastItemCreatedAt = @listController.getLastItemTimeStamp()
+    #unless lastItemCreatedAt? or lastItemCreatedAt is ""
+      #@isLoading = no
+      #log "lastItemCreatedAt is empty"
+      ## if lastItemCreatedAt is null, we assume there are no entries
+      ## and refresh the entire feed
+      #@refresh()
+      #return
+
+    #selector       =
+      #createdAt    :
+        #$gt        : options.createdAt or lastItemCreatedAt
+      #type         : { $in : options.facets or @getFilter() }
+      #isLowQuality : { $ne : options.exempt or no }
+
+    #options       =
+      #limit       : 20
+      #sort        :
+        #createdAt : -1
+
+    #KD.remote.api.CActivity.some selector, options,\
+      #KD.utils.getTimedOutCallback (err, activities) =>
+        #if err then warn err
+        #else
+
+          #KD.logToMixpanel "refresh activity feed success"
+
+          ## FIXME: SY
+          ## if it is exact 20 there may be other items
+          ## put a separator and check for new items in between
+          #if activities.length is 20
+            #warn "put a separator in between new and old activities"
+
+          #@activitiesArrived activities.reverse()
+          #@isLoading = no
+      #, =>
+        #@isLoading = no
+        #log "fetchSomeActivities timeout reached"
+
+  #fetchCachedActivity:(options = {}, callback)->
+    #options.timestamp or= options.to
+    #options.groupName   = KD.getSingleton("groupsController").getCurrentGroup()?.slug or "koding"
+    #options.facets      = @getFilter()
+
+    #KD.remote.api.CStatusActivity.fetchPublicActivityFeed options, (err, result)=>
+      #result.overview.reverse() if result?.overview
+      #return callback err, result
+
+  #fetchActivity:(options = {}, callback)->
+    #options       =
+      #limit       : options.limit    or 20
+      #to          : options.to       or Date.now()
+      #facets      : options.facets   or @getFilter()
+      #originId    : options.originId or null
+      #sort        :
+        #createdAt : -1
+
+    #{CActivity}   = KD.remote.api
+    #options.feedType = @feedType
+
+    #if options.facets is activityTypes
+      #options.facets = ['Everything']
+
+    #if @feedType is "Public"
+      #options.groupId = KD.getSingleton("groupsController").getCurrentGroup().getId()
+
+      #@fetchActivitiesFromCache options, callback
+    #else
+      #CActivity.fetchFolloweeContents options, callback
+
+  #isExempt:(callback)->
+
+    #@appStorage.fetchStorage (storage) =>
+      #flags  = KD.whoami().globalFlags
+      #exempt = flags?.indexOf 'exempt'
+      #exempt = (exempt? and exempt > -1) or storage.getAt 'bucket.showLowQualityContent'
+      #callback exempt
+
+  #fetchActivitiesDirectly:(options = {}, callback)->
+    #KD.time "Activity fetch took - "
+    #options = to : options.to or Date.now()
+
+    #@fetchActivity options, (err, teasers)=>
+      #@isLoading = no
+      #@listController.hideLazyLoader()
+      #KD.timeEnd "Activity fetch took"
+
+      #if err or teasers.length is 0
+        #warn "An error occured:", err  if err
+        #@listController.showNoItemWidget()
+      #else
+        #@extractTeasersTimeStamps(teasers)
+        #@listController.listActivities teasers
+
+      #callback? err, teasers

    panelHeight      = contentPanel.$('.activity-content')[0].clientHeight

    if scrollViewHeight + headerHeight < panelHeight
      @continueLoadingTeasers()

  createContentDisplay:(activity, callback=->)->

    for activity in activities when activity.bongo_.constructorName in filter
      @listController?.newActivityArrived activity

  teasersLoaded:->
    # the page structure has changed
    # we don't need this anymore
