-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fixes #820: maintains project.archived value when their org is archived/unarchived #1734
Conversation
5423d52
to
b94e446
Compare
b94e446
to
0a1a1d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @laura-barluzzi, thanks for submitting this PR. I only have a few comments.
For the unit tests you modified, I think you should change the test name because the archiving no longer cascades to the project level. So a name like test_archive_cascade_to_projects
is no longer true.
@@ -70,7 +70,10 @@ | |||
<img src="{{ proj.organization.logo }}" class="org-logo" alt="{{ proj.organization.name }}"/> | |||
</div> | |||
{% else %} | |||
<p class="org-name-alt">{{ proj.organization.name }}</p> | |||
<span class="org-name-alt">{{ proj.organization.name }}</span> | |||
{% if proj.organization.archived %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the organization has a logo, this archived label does not appear. (Admittedly, we can't upload org logos now, but this should still be considered.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. I didn't notice. For now I move the label outside, so it appears also with logos 👍
d798085
to
da49a4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue with the approach here; the proposed solution listed in #820 is invalid. When an organization is archived, we should continue to automatically archive its projects for a few reasons. 1) The state of a project should be consistent throughout the platform. The project of an archived organization shouldn't have its archived flag set to false while not being displayed among active projects. The implementation here creates a third state between archived and active, that of unarchived project of an archived org, which adds unnecessary complexity. We don't want to create situations in which this third state now needs to be accounted for throughout the platform UI/API and microservices, and it's counterintuitive for users and developers alike. 2) It's logically inconsistent to have an active project of an inactive organization, so we should avoid creating this case. 3) Projects are filtered by archived flag to determine whether or not their search indexes are updated; this implementation would have us unnecessarily indexing projects whose data is no longer active. This isn't the only use case where having the option to filter by active projects is of value, so retaining the validity of this flag is important. 4) When unarchiving an organization, we don't automatically want to mark every project as active. Unarchiving should be an intentional process. If an org has multiple projects, an admin may wish to only unarchive a subset of those. From a privacy and security perspective, unarchiving a project can make its data publicly available (for whatever data was public before archival). It should be a manual step for an admin to knowingly choose to make their project data available again, on a per-project basis.
The issue in #820 should be resolved by ensuring that a project's archived flag is set to True when archiving its organization, and that a project's flag is not modified (remains True) when its organization is unarchived.
@amplifi thanks for your review. I went down this road mainly because the #820 issue states:
I guess I interpreted this in my own way :) This said, I have in mind another potential solution:
In other words:
Today I make this change, it should be fairly easy and quick to do. |
* Update django-simple-history * Adjust migration file
da49a4f
to
9be89d9
Compare
I close this and open a new one. |
Proposed changes in this pull request
This PR fixes #820 Already archived projects get unarchived when org is unarchived by:
project.archived=True
when archiving an organization inorganization/views/default.OrgArchiveView.archive()
organization__archived=True
as an additional filter value for public projects inorganization/views/default.ProjectList.get()
so that all projects of archived organizations aren't displayed, despite their own.archived
field setting.if is_admin:
block using the OR query logic with Q objects.This simply adds the archived projects of not-archived organizations and all projects of archived organizations.
Archived
red flag label next to theorganization.name
in bothorganization/project_wrapper.html
andorganization/project_list.html
templates to better visualize the situation. This is mainly useful in case there are not-archived projects in an archived organization -- the missing projectArchived
red flag label is substituted by the one for their organization.OrganizationUnarchiveTest
andOrganizationArchiveTest
to meet the new logic for which the archiving of projects doesn't take place.When should this PR be merged
Risks
Follow-up actions
Checklist (for reviewing)
General
migration
label if a new migration is added.Functionality
Code
Tests
Security
Documentation