コード例 #1
0
def test_attach_notify_level_to_project_queryset():
    project1 = f.ProjectFactory.create()
    f.ProjectFactory.create()

    qs = project1.__class__.objects.order_by("id")
    qs = utils.attach_notify_level_to_project_queryset(qs, project1.owner)

    assert len(qs) == 2
    assert qs[0].notify_level == NotifyLevel.notwatch
    assert qs[1].notify_level == NotifyLevel.notwatch

    services.create_notify_policy(project1, project1.owner, NotifyLevel.watch)
    qs = project1.__class__.objects.order_by("id")
    qs = utils.attach_notify_level_to_project_queryset(qs, project1.owner)
    assert qs[0].notify_level == NotifyLevel.watch
    assert qs[1].notify_level == NotifyLevel.notwatch
コード例 #2
0
def test_attach_notify_level_to_project_queryset():
    project1 = f.ProjectFactory.create()
    f.ProjectFactory.create()

    qs = project1.__class__.objects.order_by("id")
    qs = utils.attach_notify_level_to_project_queryset(qs, project1.owner)

    assert len(qs) == 2
    assert qs[0].notify_level == NotifyLevel.involved
    assert qs[1].notify_level == NotifyLevel.involved

    services.create_notify_policy(project1, project1.owner, NotifyLevel.all)
    qs = project1.__class__.objects.order_by("id")
    qs = utils.attach_notify_level_to_project_queryset(qs, project1.owner)
    assert qs[0].notify_level == NotifyLevel.all
    assert qs[1].notify_level == NotifyLevel.involved
コード例 #3
0
ファイル: api.py プロジェクト: osule/taiga-back
    def get_queryset(self):
        qs = super().get_queryset()
        qs = self.attach_likes_attrs_to_queryset(qs)
        qs = attach_project_total_watchers_attrs_to_queryset(qs)
        if self.request.user.is_authenticated():
            qs = attach_project_is_watcher_to_queryset(qs, self.request.user)
            qs = attach_notify_level_to_project_queryset(qs, self.request.user)

        return qs
コード例 #4
0
ファイル: api.py プロジェクト: spetpet/taiga-back
    def get_queryset(self):
        qs = super().get_queryset()
        qs = self.attach_likes_attrs_to_queryset(qs)
        qs = attach_project_total_watchers_attrs_to_queryset(qs)
        if self.request.user.is_authenticated():
            qs = attach_project_is_watcher_to_queryset(qs, self.request.user)
            qs = attach_notify_level_to_project_queryset(qs, self.request.user)

        return qs