-# coffeelint: disable=space_operators
-# coffeelint: disable=no_implicit_braces
-# coffeelint: disable=no_unnecessary_double_quotes
 jraphical = require 'jraphical'
 KodingError = require '../error'
 

  # for preventing synonym links we are checking for existing
  # child topics
  checkChildTopics : (callback) ->
    Relationship.one 'targetId': @getId(), 'as': 'synonymOf', (err, childTopic) =>
      return callback err if err
      if childTopic
        return callback new KodingError "##{@title} have child topics! You must first delete them"

  addSynonym_ : (tag, callback) ->
    @addSynonym tag, (err) =>
      return callback err if err
      @update { $set: { status :'synonym' } }, (err) =>
        return callback err if err
        @constructor.emit 'TagIsSynonym', this
        callback null
