<s> from __future__ import absolute_import <EOL> from django . utils import timezone <EOL> from rest_framework . response import Response <EOL> from sentry . api . bases . organization import ( <EOL> OrganizationEndpoint , OrganizationPermission <EOL> ) <EOL> from sentry . models import OnboardingTask , OnboardingTaskStatus , OrganizationOnboardingTask <EOL> from sentry . receivers import check_for_onboarding_complete <EOL> class OrganizationOnboardingTaskEndpoint ( OrganizationEndpoint ) : <EOL> permission_classes = [ OrganizationPermission , ] <EOL> def post ( self , request , organization ) : <EOL> try : <EOL> task_id = int ( request . DATA [ '<STR_LIT>' ] ) <EOL> except ( TypeError , ValueError ) : <EOL> return Response ( status = <NUM_LIT> ) <EOL> if request . DATA [ '<STR_LIT:status>' ] == '<STR_LIT>' and task_id in ( <EOL> OnboardingTask . INVITE_MEMBER , <EOL> OnboardingTask . SECOND_PLATFORM , <EOL> OnboardingTask . USER_CONTEXT , <EOL> OnboardingTask . RELEASE_TRACKING , <EOL> OnboardingTask . SOURCEMAPS , <EOL> OnboardingTask . USER_REPORTS , <EOL> OnboardingTask . ISSUE_TRACKER , <EOL> OnboardingTask . NOTIFICATION_SERVICE <EOL> ) : <EOL> rows_affected , created = OrganizationOnboardingTask . objects . create_or_update ( <EOL> organization = organization , <EOL> user = request . user , <EOL> task = request . DATA [ '<STR_LIT>' ] , <EOL> values = { <EOL> '<STR_LIT:status>' : OnboardingTaskStatus . SKIPPED , <EOL> '<STR_LIT>' : timezone . now ( ) , <EOL> } <EOL> ) <EOL> if rows_affected or created : <EOL> check_for_onboarding_complete ( organization ) <EOL> return Response ( status = <NUM_LIT> ) <EOL> return Response ( status = <NUM_LIT> ) </s>
