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

  minute = forceTwoDigits date.getMinutes()

  # What about i18n? Does GoogleBot crawl in different languages?
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  monthName = months[month]
  return "#{monthName} #{day}, #{year} #{hour}:#{minute}"

decorateComment = (JAccount, comment, callback) ->
  createdAt = formatDate(new Date(comment.timestamp_))
  commentSummary = {body: comment.data.body, createdAt: createdAt}
  selector =
  {
    "targetId" : comment.getId(),
    "sourceName": "JAccount"
  }
  Relationship.one selector, (err, rel) =>
    if err
      console.error err
      callback null, err
    sel = { "_id" : rel.data.sourceId}

    JAccount.one sel, (err, acc) =>
      if err
        console.error err
        callback null, err
      commentSummary.authorName = acc.data.profile.firstName + " "
      commentSummary.authorName += acc.data.profile.lastName
      callback commentSummary, null

createActivityContent = (JAccount, models, comments, section, callback) ->
  model = models.first if models and Array.isArray models
  unless model
    callback null, "JStatusUpdate cannot be found."
  statusUpdateId = model.getId()
  jAccountId = model.data.originId
  selector =
  {
    "sourceId" : statusUpdateId,
    "as" : "author"
  }

  model.fetchTeaser (error, teaser)=>
    tags = []
    if teaser?.tags?
