예제 #1
0
    def put(self, request, team, project, group_id):
        group = Group.objects.get(
            id=group_id,
            project=project,
        )

        serializer = GroupSerializer(group, data=request.DATA)
        if not serializer.is_valid():
            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

        now = timezone.now()

        # It's important that we ensure state changes are atomic and that we
        # dont create multiple activity transactions
        if request.DATA.get('status') == 'resolved':
            group.resolved_at = now

            happened = Group.objects.filter(
                id=group.id,
            ).exclude(status=STATUS_RESOLVED).update(
                status=STATUS_RESOLVED,
                resolved_at=now,
            )

            if happened:
                Activity.objects.create(
                    project=project,
                    group=group,
                    type=Activity.SET_RESOLVED,
                    user=request.user,
                )

        serializer.save()

        return Response(transform(group, request))
예제 #2
0
    def put(self, request, team, project, group_id):
        group = Group.objects.get(
            id=group_id,
            project=project,
        )

        serializer = GroupSerializer(group, data=request.DATA)
        if not serializer.is_valid():
            return Response(serializer.errors,
                            status=status.HTTP_400_BAD_REQUEST)

        now = timezone.now()

        # It's important that we ensure state changes are atomic and that we
        # dont create multiple activity transactions
        if request.DATA.get('status') == 'resolved':
            group.resolved_at = now

            happened = Group.objects.filter(
                id=group.id, ).exclude(status=STATUS_RESOLVED).update(
                    status=STATUS_RESOLVED,
                    resolved_at=now,
                )

            if happened:
                Activity.objects.create(
                    project=project,
                    group=group,
                    type=Activity.SET_RESOLVED,
                    user=request.user,
                )

        serializer.save()

        return Response(transform(group, request))
예제 #3
0
    def get(self, request, team, project):
        offset = 0
        limit = 100

        response = _get_group_list(
            request=request,
            project=project,
        )

        group_list = response['event_list']
        group_list = list(group_list[offset:limit])

        # TODO: need to make a custom serializer
        results = transform(group_list, request)
        for group in results:
            group['uri'] = absolute_uri(reverse('sentry-api-0-group-details', args=(team.slug, project.slug, group['id'])))

        return Response(results)
예제 #4
0
    def get(self, request, team, project):
        offset = 0
        limit = 100

        response = _get_group_list(
            request=request,
            project=project,
        )

        group_list = response['event_list']
        group_list = list(group_list[offset:limit])

        # TODO: need to make a custom serializer
        results = transform(group_list, request)
        for group in results:
            group['uri'] = absolute_uri(
                reverse('sentry-api-0-group-details',
                        args=(team.slug, project.slug, group['id'])))

        return Response(results)