Repository: liqd/a4-meinberlin

Issue:
Initiator dashboard: too many notification
I get notifications of any projects of my organization, even it's not my project. I'm not sure if I want to see all changes in all projects of my organization. I think it will be too much.


Discussion:
@Swetlana1 I agree. 

@2e2a can we generally change the settings, so initiators only get notifications from their own projects?
Proposal on how to improve the situation:

- Only autosubscribe the *creator* of a project to that project.
- Subscribe *initiators* only to "project created" events.
Currently there is no "project created" action/event and the notifications app assumes every action is related to content inside a project. Thus it is not simple to introduce the new functionality. 
The "project created" notification should be handled when we start to rework the actions/notifications for the activity stream.

Still i would remove the autofollow function for organisation initiators. The creator of a project is not directly saved to the database, but she is added as a moderator and thus follows the project automatically

Resolving patch:
diff --git a/apps/notifications/signals.py b/apps/notifications/signals.py
--- a/apps/notifications/signals.py
+++ b/apps/notifications/signals.py
@@ -6,7 +6,6 @@
 from adhocracy4.follows.models import Follow
 from adhocracy4.phases.models import Phase
 from adhocracy4.projects.models import Project
-from apps.organisations.models import Organisation
 from . import emails
 
 
@@ -54,53 +53,3 @@ def autofollow_project_moderators(instance, action, pk_set, reverse, **kwargs):
                         'enabled': True
                     }
                 )
-
-
-@receiver(signals.m2m_changed, sender=Organisation.initiators.through)
-def autofollow_organisation_initiators(instance, action, pk_set, reverse,
-                                       **kwargs):
-    if action == 'post_add':
-        if not reverse:
-            organisation = instance
-            users_pks = pk_set
-
-            for project in Project.objects.filter(organisation=organisation):
-                for user_pk in users_pks:
-                    Follow.objects.update_or_create(
-                        project=project,
-                        creator_id=user_pk,
-                        defaults={
-                            'enabled': True
-                        }
-                    )
-        else:
-            user = instance
-            organisation_pk_set = pk_set
-
-            for project in Project.objects.filter(
-                    organisation_id__in=organisation_pk_set):
-                Follow.objects.update_or_create(
-                    project=project,
-                    creator=user,
-                    defaults={
-                        'enabled': True
-                    }
-                )
-
-
-@receiver(signals.post_save)
-def autofollow_organisation_initiators_new_projects(sender, instance, created,
-                                                    **kwargs):
-    if issubclass(sender, Project):
-        # we have to check if the senders inherits from Project to catch
-        # signals from external projects and bplans
-        project = instance
-        if created:
-            for user in project.organisation.initiators.all():
-                Follow.objects.update_or_create(
-                    project=project,
-                    creator=user,
-                    defaults={
-                        'enabled': True
-                    }
-                )


Test patch: