Merge pull request #4608 from FinnStutzenstein/autoupdateOnPermissionChangeViaStateRestrictions

send autoupdate on state update for motions
This commit is contained in:
Emanuel Schütze 2019-04-25 22:34:52 +02:00 committed by GitHub
commit 1e62501f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1425,3 +1425,14 @@ class StateViewSet(
msg = self.getProtectedErrorMessage("workflow", err) msg = self.getProtectedErrorMessage("workflow", err)
raise ValidationError({"detail": msg}) raise ValidationError({"detail": msg})
return result return result
def update(self, *args, **kwargs):
"""
Sends autoupdate for all motions that are affected by the state change.
Maybe the restriction was changed, so the view permission for some
motions could have been changed.
"""
result = super().update(*args, **kwargs)
state = self.get_object()
inform_changed_data(Motion.objects.filter(state=state))
return result