                   placeholder: 'Conversation name'
                   onkeyup: (e) ->
                       action 'conversationname', e.currentTarget.value
-              inputSetValue '.name-input', convsettings.name
 
       div class: 'input', ->
           div ->


unique = (obj) -> obj.id.chat_id or obj.id.gaia_id

photoUrlProtocolFix = (url) -> return "http:" + url if url?.indexOf('//') == 0

inputSetValue = (sel, val) ->
    setTimeout ->
        el = document.querySelector sel
        el.value = val if el != null
    , 1
    null

module.exports = view (models) ->
    {convsettings, entity} = models

                  onkeyup: (e) ->
                      chilledaction 'searchentities', e.currentTarget.value, 7
                      action 'conversationquery', e.currentTarget.value, 7

      ul ->
          convsettings.selectedEntities.forEach (r) ->
              cid = r?.id?.chat_id
              li class: 'selected', ->
                  if purl = r.properties?.photo_url ? entity[cid]?.photo_url
                      img src:photoUrlProtocolFix purl
                  else
                      img src:"images/photo.jpg"
