From: Stephen Finucane Date: Thu, 26 Aug 2021 17:18:28 +0000 (+0100) Subject: Make addressed/unaddressed workflow opt-in X-Git-Tag: v3.1.0~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4e3b06c530b76ceceeb50e1bb33381be0ecc253;p=thirdparty%2Fpatchwork.git Make addressed/unaddressed workflow opt-in The current workflow for the address/unaddressed attribute of comments sets all comments to unaddressed by default. This is unintuitive, as it assumes that all comments are actionable items. It also imposes a massive burden on maintainers, who will need to manually sift through every single comment received to a list and manually set the non-actionable items as "addressed". Change this workflow so that the 'addressed' field defaults to NULL. This means maintainers or users must manually set this to False when they're requesting additional feedback. This is currently possible via the web UI or REST API. A future change will make it possible via a custom mail header. Signed-off-by: Stephen Finucane Cc: Raxel Gutierrez Cc: Daniel Axtens --- diff --git a/docs/api/schemas/latest/patchwork.yaml b/docs/api/schemas/latest/patchwork.yaml index e3bff990..2a98c179 100644 --- a/docs/api/schemas/latest/patchwork.yaml +++ b/docs/api/schemas/latest/patchwork.yaml @@ -1669,12 +1669,14 @@ components: addressed: title: Addressed type: boolean + nullable: true CommentUpdate: type: object properties: addressed: title: Addressed type: boolean + nullable: true CoverList: type: object properties: diff --git a/docs/api/schemas/patchwork.j2 b/docs/api/schemas/patchwork.j2 index 3b4ad2f6..02aa9f72 100644 --- a/docs/api/schemas/patchwork.j2 +++ b/docs/api/schemas/patchwork.j2 @@ -1734,12 +1734,14 @@ components: addressed: title: Addressed type: boolean + nullable: true CommentUpdate: type: object properties: addressed: title: Addressed type: boolean + nullable: true {% endif %} CoverList: type: object diff --git a/docs/api/schemas/v1.3/patchwork.yaml b/docs/api/schemas/v1.3/patchwork.yaml index 6cbba646..0a9046a5 100644 --- a/docs/api/schemas/v1.3/patchwork.yaml +++ b/docs/api/schemas/v1.3/patchwork.yaml @@ -1669,12 +1669,14 @@ components: addressed: title: Addressed type: boolean + nullable: true CommentUpdate: type: object properties: addressed: title: Addressed type: boolean + nullable: true CoverList: type: object properties: diff --git a/htdocs/js/submission.js b/htdocs/js/submission.js index 47cffc82..c93c36ec 100644 --- a/htdocs/js/submission.js +++ b/htdocs/js/submission.js @@ -29,7 +29,17 @@ $( document ).ready(function() { }; updateProperty(url, data, updateMessage).then(isSuccess => { if (isSuccess) { - $("div[class^='comment-status-bar-'][data-comment-id='"+commentId+"']").toggleClass("hidden"); + // The API won't accept anything but true or false, so we + // always hide the -action-required element + $("div[class='comment-status-bar-action-required'][data-comment-id='"+commentId+"']").addClass("hidden"); + + if (event.target.value === "true") { + $("div[class^='comment-status-bar-addressed'][data-comment-id='"+commentId+"']").removeClass("hidden"); + $("div[class^='comment-status-bar-unaddressed'][data-comment-id='"+commentId+"']").addClass("hidden"); + } else if (event.target.value === "false") { + $("div[class^='comment-status-bar-addressed'][data-comment-id='"+commentId+"']").addClass("hidden"); + $("div[class^='comment-status-bar-unaddressed'][data-comment-id='"+commentId+"']").removeClass("hidden"); + } } }) }); @@ -59,4 +69,4 @@ $( document ).ready(function() { toggleDiv("toggle-related-outside", "related-outside", "show from other projects"); }); } -}); \ No newline at end of file +}); diff --git a/patchwork/migrations/0045_addressed_fields.py b/patchwork/migrations/0045_addressed_fields.py index ed3527bc..22887c33 100644 --- a/patchwork/migrations/0045_addressed_fields.py +++ b/patchwork/migrations/0045_addressed_fields.py @@ -13,11 +13,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='covercomment', name='addressed', - field=models.BooleanField(default=False), + field=models.BooleanField(null=True), ), migrations.AddField( model_name='patchcomment', name='addressed', - field=models.BooleanField(default=False), + field=models.BooleanField(null=True), ), ] diff --git a/patchwork/models.py b/patchwork/models.py index 58e4c51e..6304b34d 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -657,7 +657,7 @@ class CoverComment(EmailMixin, models.Model): related_query_name='comment', on_delete=models.CASCADE, ) - addressed = models.BooleanField(default=False) + addressed = models.BooleanField(null=True) @property def list_archive_url(self): @@ -708,7 +708,7 @@ class PatchComment(EmailMixin, models.Model): related_query_name='comment', on_delete=models.CASCADE, ) - addressed = models.BooleanField(default=False) + addressed = models.BooleanField(null=True) @property def list_archive_url(self): diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index 2238e82e..2814f3d5 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -285,7 +285,19 @@ {{ item.date }} UTC | #{{ forloop.counter }} - {% if item.addressed %} + {% if item.addressed == None %} +
+ {% else %} + + {% if item.addressed == True %}
{% else %} - {% if item.addressed %} -