move Model::hasPending and whenNothingPending into connections.js so that it can be used in the client