if (!evt || !(payload = evt.payload)) return $q.when();
promises.push(service.flesh_copy_location(payload.copy));
- promises.push(
- service.flesh_copy_status(payload.copy)
-
- .then(function() {
- // copy is in transit, but no transit was delivered
- // in the payload. Do this here instead of below to
- // ensure consistent copy status fleshiness
- if (!payload.transit && payload.copy.status().id() == 6) { // in-transit
- return service.find_copy_transit(evt, params, options)
- .then(function(trans) {
- if (trans) {
- trans.source(egCore.org.get(trans.source()));
- trans.dest(egCore.org.get(trans.dest()));
- payload.transit = trans;
- }
- })
- }
- })
- );
+ if (payload.copy) {
+ promises.push(
+ service.flesh_copy_status(payload.copy)
+
+ .then(function() {
+ // copy is in transit, but no transit was delivered
+ // in the payload. Do this here instead of below to
+ // ensure consistent copy status fleshiness
+ if (!payload.transit && payload.copy.status().id() == 6) { // in-transit
+ return service.find_copy_transit(evt, params, options)
+ .then(function(trans) {
+ if (trans) {
+ trans.source(egCore.org.get(trans.source()));
+ trans.dest(egCore.org.get(trans.dest()));
+ payload.transit = trans;
+ }
+ })
+ }
+ })
+ );
+ }
// local flesh transit
if (transit = payload.transit) {
// Currently defaults to /eg/staff for all pages.
// Use $location.path() to jump around within an app.
// Use egEnv.basePath to create URLs to new apps.
- service.basePath =
- $window.document.getElementsByTagName('base')[0].getAttribute('href');
+ // NOTE: the dynamic version below derived from the DOM does not
+ // work w/ unit tests. Use hard-coded value instead for now.
+ service.basePath = '/eg/staff/';
+ //$window.document.getElementsByTagName('base')[0].getAttribute('href');
/* returns a promise, loads all of the specified classes */
service.load = function() {