Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Sync plan_activated_users during sync_teams #902

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
cleanup
  • Loading branch information
suejung-sentry committed Jan 30, 2025
commit a001d68be7128c3f65fd15bbb81a8522afa4eeeb
6 changes: 4 additions & 2 deletions tasks/sync_teams.py
Original file line number Diff line number Diff line change
@@ -59,13 +59,15 @@
),
)
for org_ownerid in removed_orgs:
org = db_session.query(Owner).filter(Owner.ownerid == org_ownerid).first()
org = (
db_session.query(Owner).filter(Owner.ownerid == org_ownerid).first()
)
if org and ownerid in org.plan_activated_users:
log.info(

Check warning on line 66 in tasks/sync_teams.py

Codecov Notifications / codecov/patch

tasks/sync_teams.py#L66

Added line #L66 was not covered by tests
"Removing user from org's plan_activated_users",
extra=dict(user_ownerid=ownerid, org_ownerid=org_ownerid)
extra=dict(user_ownerid=ownerid, org_ownerid=org_ownerid),
)
org.plan_activated_users.remove(ownerid)

Check warning on line 70 in tasks/sync_teams.py

Codecov Notifications / codecov/patch

tasks/sync_teams.py#L70

Added line #L70 was not covered by tests

owner.updatestamp = datetime.now()
owner.organizations = team_ids
1 change: 1 addition & 0 deletions tasks/tests/unit/test_sync_teams_task.py
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ def test_team_removed(self, mocker, mock_configuration, dbsession, codecov_vcr):
)
prev_team.plan_activated_users = [user.ownerid]
dbsession.add(user)
dbsession.add(prev_team)
dbsession.flush()
SyncTeamsTask().run_impl(dbsession, user.ownerid, using_integration=False)
assert prev_team.ownerid not in user.organizations
Loading
Oops, something went wrong.