Only publish specified apps to the exchange.

[Ticket](http://manage.dimagi.com/default.asp?151638)
There was a bug where all apps in a domain would be published to the exchange, even when their "publish" checkbox was unchecked. This bug was introduced by a fix (https://github.com/dimagi/commcare-hq/pull/5159) for a related bug that was causing no apps to be published. This original bug was introduced in #4640.

The root cause of both of these issues was this:
The app docs that were being published were being filtered by a list of doc ids (that happens [here](https://github.com/dimagi/commcare-hq/blob/31ee4beb59bcca875393f0c2ff03a5e667a81cf5/corehq/apps/domain/models.py#L677-L680)). This list of app docs was coming from the `domain/related_to_domain` couch view, and only contained the original versions of each app, not copies. However, the list of doc ids (called `copy_by_id`) contained the doc ids of the latest saved copies of the original apps, not the original app documents themselves (that happens [here](https://github.com/dimagi/commcare-hq/blob/31ee4beb59bcca875393f0c2ff03a5e667a81cf5/corehq/apps/domain/views.py#L1512), among other places).

This resulted in the apps specified by the user (that is, the latest saved versions) never matching the apps retrieved by the view (the "original" docs). This is what caused the original bug where no apps were being copied. The attempted fix ignored the filtering altogether, which resulted in all the apps being published.

It's possible that a cleaner fix to this problem would be to just use the original apps instead of their latest saved versions in the first place, but I haven't couldn't quite figured out why it was implemented this way in the first place.

FYI @emord @esoergel 
Yeah, this will could be up to two queries for each app, plus the one to get the applications.

The better way to solve this bug is to probably to modify the [SnapshotApplicationForm](https://github.com/dimagi/commcare-hq/blob/6649fafab3bd4ef0235ac819b414d4256b7eb6cf/corehq/apps/domain/views.py#L1517) so that it passes the "original" app ids instead of the latest saved ids to the view in the first place. I don't know how high priority this improvement should be, but I might take a crack at it today.