 { isLoggedIn, error_404, error_500 } = require '../server/helpers'
-
+{htmlEncode} = require 'htmlencode'
 kodinghome = require './staticpages/kodinghome'
 activity = require './staticpages/activity'
 profile = require './staticpages/profile'

                      queue.commentSummaries.push commentSummary
                    queue.next()
                else queue.next()
              queue.push => 
                createActivityContent JAccount, models, \
                  queue.commentSummaries, section, (content, error)=>
                    queue.next() if error
                    return res.send 200, content
              daisy queue
      else 
        return res.send 404, error_404("No section is given.")
    else
      isLoggedIn req, res, (err, loggedIn, account)->


    Relationship.one selector, (err, rel) =>
      if err
          console.error err
          callback null, err
      sel =
      {
        "_id" : rel.data.targetId
      }
      JAccount.one sel, (err, acc) =>
        if err
          console.error err
          callback null, err
        fullName = acc.data.profile.firstName + " "
        fullName += acc.data.profile.lastName
        activityContent = {
          fullName : fullName
          hash : acc.data.profile.hash
          title : if model.title then model.title else model.body or ""
          body : if model.body  then model.body  else ""
          codeSnippet : htmlEncode codeSnippet
          createdAt : formatDate(model.data?.meta?.createdAt)
          numberOfComments : comments?.length or 0
          numberOfLikes : model?.data?.meta?.likes or 0
