       threadMentions[author] -= 1 for author in mentions
   , [(key for key of message.authors).join('@'), message.title, message.body, usernames]
 
+  messageFileRef = useRef()
+  useEffect ->
+    return if folded or history? or not messageFileRef.current?
+    listener = messageOnDragStart message
+    elts = messageFileRef.current.querySelectorAll 'img, video, a, canvas'
+    elt.addEventListener 'dragstart', listener for elt in elts
+    -> elt.removeEventListener 'dragstart', listener for elt in elts
+  , [folded, history?, messageFileRef.current, message]
+
   onFold = (e) ->
     e.preventDefault()
     e.stopPropagation()

  #console.log "#{id} corresponds to #{image}"
  checkImage image if image?

messageDrag = (target, bodyToo = true, old) ->
  return unless target
  onDragStart = (e) =>
    #url = "coauthor:#{@data._id}"
    url = urlFor 'message',
      group: @data.group
      message: @data._id
    e.dataTransfer.effectAllowed = 'linkMove'
    e.dataTransfer.setData 'text/plain', url
    e.dataTransfer.setData 'application/coauthor-id', @data._id
    e.dataTransfer.setData 'application/coauthor-type', type
  type = 'message'
  if @data.file
    type = fileType @data.file
    #console.log @data.file, type
    #if "class='odd-file'" not in formatted and
    #   "class='bad-file'" not in formatted
    #  url = formatted
    if bodyToo
      $(@find '.message-file')?.find('img, video, a, canvas')?.each (i, elt) =>
        elt.removeEventListener 'dragstart', old if old?
        elt.addEventListener 'dragstart', onDragStart
  target.removeEventListener 'dragstart', old if old?
  target.addEventListener 'dragstart', onDragStart
  onDragStart

## A message is "naturally" folded if it is flagged as minimized or deleted.
## It still will be default-folded if it's an image referenced in another

                      +messagePDF
                  ###}
                  <p className="message-file"
                   dangerouslySetInnerHTML={__html: formattedFile.file} ref={messageFileRef}/>
                }
              </div>
            </div>
