         { name: 'updateInstance' }
         { name: 'RemovedFromCollection' }
       ]
+    permissions :
+      'edit comments'     : ['moderator']
+      'edit own comments' : ['moderator']
     schema         :
       isLowQuality : Boolean
       body         :


  {ObjectId,ObjectRef,dash,daisy,secure,signature} = require 'bongo'
  {Relationship}  = require 'jraphical'

  @trait __dirname, '../../../traits/likeable'
  @trait __dirname, '../../../traits/notifying'
  @trait __dirname, '../../../traits/grouprelated'

  @share()


  unflagIsLowQuality:(callback)->
    @_flagIsLowQuality no, 1, callback

  modify: permit
    advanced: [
        { permission: 'edit own comments', validateWith: Validators.own }
        { permission: 'edit comments' }
      ]
    success: (client, body, callback) ->
      {delegate} = client.connection

      body = body?.trim()
      if not body? or body is ""
        return callback new KodingError "Comment cannot be empty"

      editedBy = ObjectRef(delegate)
      return @update $set: {body, editedAt: new Date, editedBy}, callback unless body is @body

      callback null
