From affd66521d94de886639bea3a0238dc7d43011cb Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Tue, 12 Jul 2016 17:33:55 -0400 Subject: [PATCH] avoid building urls to deleted resources, resolves #2948 (#2956) --- awx/ui/client/src/widgets/Stream.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/ui/client/src/widgets/Stream.js b/awx/ui/client/src/widgets/Stream.js index f3e9271264..bd9b0011a4 100644 --- a/awx/ui/client/src/widgets/Stream.js +++ b/awx/ui/client/src/widgets/Stream.js @@ -32,6 +32,11 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti // try/except pattern asserts that: // if we encounter a case where a UI url can't or shouldn't be generated, just supply the name of the resource try { + // catch-all case to avoid generating urls if a resource has been deleted + // if a resource still exists, it'll be serialized in the activity's summary_fields + if (!activity.summary_fields[resource]){ + throw {name : 'ResourceDeleted', message: 'The referenced resource no longer exists'}; + } switch (resource) { case 'custom_inventory_script': url += 'inventory_scripts/' + obj.id + '/';