Add "withdrawn" commitfest status
authorMagnus Hagander <[email protected]>
Sun, 23 Dec 2018 12:07:56 +0000 (13:07 +0100)
committerMagnus Hagander <[email protected]>
Sun, 23 Dec 2018 12:07:56 +0000 (13:07 +0100)
By popular (?) request

pgcommitfest/commitfest/migrations/0003_withdrawn_status.py [new file with mode: 0644]
pgcommitfest/commitfest/models.py
pgcommitfest/commitfest/static/commitfest/js/commitfest.js
pgcommitfest/commitfest/templates/patch_commands.inc
pgcommitfest/commitfest/views.py
pgcommitfest/urls.py

diff --git a/pgcommitfest/commitfest/migrations/0003_withdrawn_status.py b/pgcommitfest/commitfest/migrations/0003_withdrawn_status.py
new file mode 100644 (file)
index 0000000..346adf9
--- /dev/null
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('commitfest', '0002_notifications'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='patchoncommitfest',
+            name='status',
+            field=models.IntegerField(default=1, choices=[(1, b'Needs review'), (2, b'Waiting on Author'), (3, b'Ready for Committer'), (4, b'Committed'), (5, b'Moved to next CF'), (6, b'Rejected'), (7, b'Returned with feedback'), (8, b'Withdrawn')]),
+        ),
+               migrations.RunSQL("""
+INSERT INTO commitfest_patchstatus (status, statusstring, sortkey) VALUES
+(1,'Needs review',10),
+(2,'Waiting on Author',15),
+(3,'Ready for Committer',20),
+(4,'Committed',25),
+(5,'Moved to next CF',30),
+(6,'Rejected',50),
+(7,'Returned with Feedback',50),
+(8,'Withdrawn', 50)
+ON CONFLICT (status) DO UPDATE SET statusstring=excluded.statusstring, sortkey=excluded.sortkey;
+"""),
+               migrations.RunSQL("DELETE FROM commitfest_patchstatus WHERE status < 1 OR status > 8"),
+    ]
index 8e5a442926ee1646759d46687e0304d1d5285fc1..60dcaf4cc6b59c3f81ad9fa431f237af364fd187 100644 (file)
@@ -159,6 +159,7 @@ class PatchOnCommitFest(models.Model):
        STATUS_NEXT=5
        STATUS_REJECTED=6
        STATUS_RETURNED=7
+       STATUS_WITHDRAWN=8
        _STATUS_CHOICES=(
                (STATUS_REVIEW, 'Needs review'),
                (STATUS_AUTHOR, 'Waiting on Author'),
@@ -166,7 +167,8 @@ class PatchOnCommitFest(models.Model):
                (STATUS_COMMITTED, 'Committed'),
                (STATUS_NEXT, 'Moved to next CF'),
                (STATUS_REJECTED, 'Rejected'),
-               (STATUS_RETURNED, 'Returned with feedback')
+               (STATUS_RETURNED, 'Returned with feedback'),
+               (STATUS_WITHDRAWN, 'Withdrawn'),
        )
        _STATUS_LABELS=(
                (STATUS_REVIEW, 'default'),
@@ -176,6 +178,7 @@ class PatchOnCommitFest(models.Model):
                (STATUS_NEXT, 'warning'),
                (STATUS_REJECTED, 'danger'),
                (STATUS_RETURNED, 'danger'),
+               (STATUS_WITHDRAWN, 'danger'),
        )
        OPEN_STATUSES=[STATUS_REVIEW, STATUS_AUTHOR, STATUS_COMMITTER]
        OPEN_STATUS_CHOICES=[x for x in _STATUS_CHOICES if x[0] in OPEN_STATUSES]
index 84d728d3c044ac4a3920c467030e56e1e201a83b..69c41ecec3092447f3f279a28e5478c2d942f305 100644 (file)
@@ -1,6 +1,9 @@
 function verify_reject() {
    return confirm('Are you sure you want to close this patch as Rejected?\n\nThis should only be done when a patch will never be applied - if more work is needed, it should instead be set to "Returned with Feedback" or "Moved to next CF".\n\nSo - are you sure?');
 }
+function verify_withdrawn() {
+   return confirm('Are you sure you want to close this patch as Withdrawn?\n\nThis should only be done when the author voluntarily withdraws the patch.\n\nSo - are you sure?');
+}
 function verify_returned() {
    return confirm('Are you sure you want to close this patch as Returned with Feedback?\n\nThis should be done if the patch is expected to be finished at some future time, but not necessarily in the next commitfest. If work is undergoing and expected in the next commitfest, it should instead be set to "Moved to next CF".\n\nSo - are you sure?');
 }
index d2861ac3b96ca8a83fa6d758028f3ff14592c8e9..8f18f7126055dd13f281875012895bfeea8cb2be 100644 (file)
@@ -19,6 +19,7 @@
   <li role="presentation" class="divider"></li>
   <li role="presentation" class="dropdown-header">Closed statuses</li>
   <li role="presentation"><a href="close/reject/" onclick="return verify_reject()">Rejected</a></li>
+  <li role="presentation"><a href="close/withdrawn/" onclick="return verify_withdrawn()">Withdrawn</a></li>
   <li role="presentation"><a href="close/feedback/" onclick="return verify_returned()">Returned with feedback</a></li>
   <li role="presentation"><a href="close/next/" onclick="return verify_next()">Move to next CF</a></li>
   <li role="presentation"><a href="close/committed/" onclick="return flagCommitted({%if patch.committer%}'{{patch.committer}}'{%elif is_committer%}'{{user.username}}'{%else%}null{%endif%})">Committed</a></li>
index 47c38489bb655488b22e94d867e58dee26d61dbe..5f6889501e3fc410455318d8660b95d01b125ccc 100644 (file)
@@ -520,6 +520,8 @@ def close(request, cfid, patchid, status):
        # need to check if the individual status has changed.
        if status == 'reject':
                poc.status = PatchOnCommitFest.STATUS_REJECTED
+       elif status == 'withdrawn':
+               poc.status = PatchOnCommitFest.STATUS_WITHDRAWN
        elif status == 'feedback':
                poc.status = PatchOnCommitFest.STATUS_RETURNED
        elif status == 'next':
index eafb99cf9d3b50f3cafbcc6a6f85462b82c4c691..109a341bf6b29eda18cad54f5cf6ba734d6f3b35 100644 (file)
@@ -21,7 +21,7 @@ urlpatterns = [
     url(r'^(\d+)/(\d+)/edit/$', views.patchform),
     url(r'^(\d+)/new/$', views.newpatch),
     url(r'^(\d+)/(\d+)/status/(review|author|committer)/$', views.status),
-    url(r'^(\d+)/(\d+)/close/(reject|feedback|committed|next)/$', views.close),
+    url(r'^(\d+)/(\d+)/close/(reject|withdrawn|feedback|committed|next)/$', views.close),
     url(r'^(\d+)/(\d+)/reviewer/(become|remove)/$', views.reviewer),
     url(r'^(\d+)/(\d+)/committer/(become|remove)/$', views.committer),
     url(r'^(\d+)/(\d+)/(un)?subscribe/$', views.subscribe),