Refactoring linkDialog with promise.