Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/sentry/api/endpoints/project_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from sentry.api.serializers.rest_framework import ListField, OriginField
from sentry.models import (
AuditLogEntryEvent, Group, GroupStatus, Project, ProjectBookmark, ProjectStatus,
UserOption, Team,
ProjectTeam, UserOption, Team,
)
from sentry.tasks.deletion import delete_project
from sentry.utils.apidocs import scenario, attach_scenarios
Expand Down Expand Up @@ -242,6 +242,7 @@ def put(self, request, project):
project.name = result['name']
changed = True

old_team_id = None
if result.get('team'):
team_list = [
t for t in Team.objects.get_for_user(
Expand All @@ -257,6 +258,7 @@ def put(self, request, project):
'detail': ['The new team is not found.']
}, status=400
)
old_team_id = project.team_id
project.team = team_list[0]
changed = True

Expand All @@ -266,6 +268,11 @@ def put(self, request, project):

if changed:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverage doesn't seem happy about either of these branches, might be worthwhile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm now it says 100% of diff hit, so i think it's ok?

project.save()
if old_team_id is not None:
ProjectTeam.objects.filter(
project=project,
team_id=old_team_id,
).update(team=project.team)

if result.get('isBookmarked'):
try:
Expand Down
49 changes: 0 additions & 49 deletions src/sentry/web/forms/add_project.py

This file was deleted.

1 change: 1 addition & 0 deletions tests/sentry/api/endpoints/test_project_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def test_team_changes(self):
assert resp.status_code == 200, resp.content
project = Project.objects.get(id=project.id)
assert project.team == team
assert project.teams.first() == team

def test_team_changes_not_found(self):
project = self.create_project()
Expand Down