Fix Redmine/5748 - make defaults promises work in bundles using classes promise

This is purely refactoring and removing code duplication.