Work to complete AC-673, mass refactoring of the activity stream. Some work towards AC-664/662 but will complete on those issues. This also fixes issue AC-743 (Adding help text for OPTIONS requests) and AC-675 (updates where active changes to False will now be treated as deletes)

This commit is contained in:
Matthew Jones
2013-12-10 16:08:35 -05:00
parent ca87fa714f
commit 61059fa1a4
13 changed files with 1760 additions and 111 deletions

View File

@@ -41,21 +41,21 @@ class ActivityStreamMiddleware(object):
continue
if drf_user is not None and drf_user.__class__ != AnonymousUser:
instance.user = drf_user
instance.actor = drf_user
try:
instance.save()
except IntegrityError, e:
logger.debug("Integrity Error saving Activity Stream instance for id : " + str(instance_id))
else:
obj1_type_actual = instance.object1_type.split(".")[-1]
if obj1_type_actual in ("InventoryUpdate", "ProjectUpdate", "Job") and instance.id is not None:
instance.delete()
# else:
# obj1_type_actual = instance.object1_type.split(".")[-1]
# if obj1_type_actual in ("InventoryUpdate", "ProjectUpdate", "Job") and instance.id is not None:
# instance.delete()
return response
def set_actor(self, user, sender, instance, **kwargs):
if sender == ActivityStream:
if isinstance(user, User) and instance.user is None:
instance.user = user
instance.actor = user
instance.save()
else:
if instance.id not in self.instances: