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

Audit: attach organization #8491

Merged
merged 1 commit into from Sep 15, 2021
Merged

Audit: attach organization #8491

merged 1 commit into from Sep 15, 2021

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Sep 14, 2021

Realized that after a project is deleted,
we don't know from what organization it was.
(well, we can with the historical models,
but having that information here makes it more easy to filter by).

Realized that after a project is deleted,
we don't know from what organization it was.
(well, we can with the historical models,
but having that information here makes it more easy to filter by).
@stsewd stsewd requested review from ericholscher and a team September 14, 2021 21:03
Comment on lines +127 to +132
log_organization_id = models.IntegerField(
_('Organization ID'),
blank=True,
null=True,
db_index=True,
)
Copy link
Member

Choose a reason for hiding this comment

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

Why is the organization id relevant? Shouldn't be enough with the organization slug?

Copy link
Member Author

Choose a reason for hiding this comment

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

We want to keep track of the organization after it has been deleted. The id is the source of truth, as another organization can be created with the same slug. We save the slug to make it more friendly to recognize the original organization or display.

Copy link
Member

Choose a reason for hiding this comment

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

This should be a comment in the code, not in a PR ;)

Comment on lines +181 to +182
organization = self.project.organizations.first()
if organization:
Copy link
Member

Choose a reason for hiding this comment

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

Un-related to this PR: now that we have Organizations in .org, we can migrate the ManyToMany from Organization model into a ForeignKey in the Project model and avoid all these .first() checks we have all around the code.

@stsewd stsewd merged commit 76c7c1d into master Sep 15, 2021
@stsewd stsewd deleted the audit-include-organization branch September 15, 2021 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants