Skip to content
Open
Next Next commit
models: Add Note model
Signed-off-by: andrepapoti <andrepapoti@gmail.com>
  • Loading branch information
andrepapoti authored and victor-accarini committed Jan 24, 2025
commit caf054aaee4098fe8bef63675d3e4c4b4922657d
19 changes: 19 additions & 0 deletions patchwork/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ def validate_regex_compiles(regex_string):
raise ValidationError('Invalid regular expression entered!')


class TimestampMixin(models.Model):
updated_at = models.DateTimeField(auto_now=True)
created_at = models.DateTimeField(auto_now_add=True)

class Meta:
abstract = True


class Person(models.Model):
# properties

Expand Down Expand Up @@ -823,6 +831,17 @@ class Meta:
]


class Note(TimestampMixin, models.Model):
patch = models.ForeignKey(
Patch,
related_name='notes',
on_delete=models.CASCADE,
)
submitter = models.ForeignKey(User, on_delete=models.CASCADE)
content = models.TextField(null=False, blank=True)
maintainer_only = models.BooleanField(default=True)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are these not always maintainer-only? Why would we ever want to make them public?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not necessarily, it may be used to transmit additional context for reviewers that may not be adequate to have in the commit message, in this context it would make sense to have public notes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Any broader discussion should happen on the mailing list, really.
If we're risking splintering the discussion I'd rather not have this feature at all :S



class Series(FilenameMixin, models.Model):
"""A collection of patches."""

Expand Down