Don't delete subscription if sub_resource is set

This patch stops subscriptions being erroneously deleted if a DELETE
request is recieved with a path which has a sub_resource but no
sub_resource_id. For example:

    DELETE /v1/stories/1/tags

This fixes a bug whereby deleting a tag from a story unsubscribes
everyone from that story.

Change-Id: I2166ae63d940ec40e45a8bb7a97779099131f7cd
This commit is contained in:
Adam Coldrick 2015-12-08 14:04:37 +00:00
parent a15f920a2f
commit 708f6f2177

View File

@ -63,7 +63,7 @@ class Subscription(WorkerTaskBase):
author=author,
subscribers=subscribers)
if method == 'DELETE' and not sub_resource_id:
if method == 'DELETE' and not (sub_resource_id or sub_resource):
self.handle_deletions(session, resource, resource_id)
def handle_deletions(self, session, resource_name, resource_id):