[PATCH v3 07/10] models: add addressed field and change edit permissions for comments

Daniel Axtens dja at axtens.net
Fri Aug 20 10:25:10 AEST 2021


Raxel Gutierrez <raxel at google.com> writes:

> Currently, there is no state or status associated with patch comments.
> In particular, knowing whether a comment on a patch is addressed or not
> is useful for transparency and accountability in the patch review and
> contribution process. This patch is backend setup for tracking the state
> of patch comments.
>
> Add `addressed` boolean field to PatchComment to be able to distinguish
> between unaddressed and addressed comments in the patch-detail page.
> Change PatchComment edit permissions to match that of the patch
> associated with the comment (i.e. patch author, project maintainers, and
> delegate) and add permissions to change `addressed` status for comment
> authors as well.
>

As discussed in another email, I tested the migration and I have no
concerns about it.

Reviewed-by: Daniel Axtens <dja at axtens.net>

I'm not planning to merge this until we have a user, but I think the
remainder of the series is very close to being mergable.

Kind regards,
Daniel

> Signed-off-by: Raxel Gutierrez <raxel at google.com>
> ---
>  .../migrations/0045_patchcomment_addressed.py  | 18 ++++++++++++++++++
>  patchwork/models.py                            |  5 ++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
>  create mode 100644 patchwork/migrations/0045_patchcomment_addressed.py
>
> diff --git a/patchwork/migrations/0045_patchcomment_addressed.py b/patchwork/migrations/0045_patchcomment_addressed.py
> new file mode 100644
> index 0000000..92e6c4e
> --- /dev/null
> +++ b/patchwork/migrations/0045_patchcomment_addressed.py
> @@ -0,0 +1,18 @@
> +# Generated by Django 3.1.12 on 2021-07-16 04:12
> +
> +from django.db import migrations, models
> +
> +
> +class Migration(migrations.Migration):
> +
> +    dependencies = [
> +        ('patchwork', '0044_add_project_linkname_validation'),
> +    ]
> +
> +    operations = [
> +        migrations.AddField(
> +            model_name='patchcomment',
> +            name='addressed',
> +            field=models.BooleanField(default=False),
> +        ),
> +    ]
> diff --git a/patchwork/models.py b/patchwork/models.py
> index 00273da..ef52f2c 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -693,6 +693,7 @@ class PatchComment(EmailMixin, models.Model):
>          related_query_name='comment',
>          on_delete=models.CASCADE,
>      )
> +    addressed = models.BooleanField(default=False)
>  
>      @property
>      def list_archive_url(self):
> @@ -718,7 +719,9 @@ class PatchComment(EmailMixin, models.Model):
>          self.patch.refresh_tag_counts()
>  
>      def is_editable(self, user):
> -        return False
> +        if user == self.submitter.user:
> +            return True
> +        return self.patch.is_editable(user)
>  
>      class Meta:
>          ordering = ['date']
> -- 
> 2.33.0.rc1.237.g0d66db33f3-goog
>
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork


More information about the Patchwork mailing list