Ejemplo n.º 1
0
    team = FlexibleForeignKey("sentry.Team")

    objects = ProjectTeamManager()

    class Meta:
        app_label = "sentry"
        db_table = "sentry_projectteam"
        unique_together = (("project", "team"), )

    __repr__ = sane_repr("project_id", "team_id")


post_save.connect(
    lambda instance, **kwargs: update_code_owners_schema.apply_async(
        kwargs={
            "organization": instance.project.organization,
            "projects": [instance.project],
        }),
    sender=ProjectTeam,
    weak=False,
)
post_delete.connect(
    lambda instance, **kwargs: update_code_owners_schema.apply_async(
        kwargs={
            "organization": instance.project.organization,
            "projects": [instance.project],
        }),
    sender=ProjectTeam,
    weak=False,
)
Ejemplo n.º 2
0
 def post_save(self, instance, **kwargs):
     update_code_owners_schema.apply_async(
         kwargs={
             "organization": instance.organization,
             "projects": instance.get_projects(),
         }),
Ejemplo n.º 3
0
    class Meta:
        app_label = "sentry"
        db_table = "sentry_externalactor"
        unique_together = (("organization", "provider", "external_name", "actor"),)

    def delete(self, **kwargs):
        from sentry.models import NotificationSetting

        # There is no foreign key relationship so we have to manually cascade.
        NotificationSetting.objects._filter(
            target_ids=[self.actor_id], provider=ExternalProviders(self.provider)
        ).delete()

        return super().delete(**kwargs)


post_save.connect(
    lambda instance, **kwargs: update_code_owners_schema.apply_async(
        kwargs={"organization": instance.organization, "integration": instance.integration}
    ),
    sender=ExternalActor,
    weak=False,
)
post_delete.connect(
    lambda instance, **kwargs: update_code_owners_schema.apply_async(
        kwargs={"organization": instance.organization, "integration": instance.integration}
    ),
    sender=ExternalActor,
    weak=False,
)