-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(prop-defs): add hidden option to property definitions #29085
Changes from 8 commits
7e0849a
0d5f776
96e3063
b002853
4c1a568
08271a1
8051106
b0182a0
df7d08a
47fdd9e
63268e3
2f46373
12f860c
eecb4cd
916cc42
2aba5ff
72689ab
5b16232
e66be82
87ec065
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.18 on 2025-02-21 04:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("ee", "0021_conversation_status"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="enterprisepropertydefinition", | ||
name="hidden", | ||
field=models.BooleanField(blank=True, default=False, null=True), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider making null=False since default=False is provided. Having both nullable and a default value can lead to ambiguous states. |
||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0021_conversation_status | ||
0022_enterprisepropertydefinition_hidden |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,6 +19,7 @@ class EnterprisePropertyDefinition(PropertyDefinition): | |||||
blank=True, | ||||||
related_name="property_verifying_user", | ||||||
) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd rather this go into the activity log tbh... and I don't feel like doing that now 😬 Is that cool with you or do you really think it should be included? |
||||||
hidden = models.BooleanField(blank=True, null=True, default=False) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider making hidden field non-nullable since it has a default value. This would simplify logic and prevent potential null checks.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good suggestion, same as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to allow null I think so that the existing rows don't all have to be updated, if anything I would remove the default. Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you create a non-nullable column with a default value in postgres any existing rows in the table will be automatically filled with that default value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah exactly, and I don't want to have it touch every single row to fill them in with the new default as this can lock up the table (though maybe in newer versions of postgres this is less of an issue?). So saying it can be null means all existing rows are left alone and new ones just use the default. |
||||||
|
||||||
# Deprecated in favour of app-wide tagging model. See EnterpriseTaggedItem | ||||||
deprecated_tags: ArrayField = ArrayField(models.CharField(max_length=32), null=True, blank=True, default=list) | ||||||
|
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.
Why is this logic duplicated here?
validate
should be called beforeupdate
so if it was all invalidate
then should be covered?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.
I don't know 🙈
@Twixes how are the multiple API endpoints used - there is one for ee and one for non-ee. My ee tests didn't pass without the ee api changes so I just copied them over...