[MediaWiki-commits] [Gerrit] labs/striker[master]: Enhance workflow for tool labs membership requests
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/374104 ) Change subject: Enhance workflow for tool labs membership requests .. Enhance workflow for tool labs membership requests * Replace admin notes with timestamped comments. * Add "feedback needed" state for requests. * Change status from "pending" to "feedback needed" when admin comments without resolving. * Change status from "feedback needed" to "pending" when applicant replies. Bug: T168027 Change-Id: Ifa395b791dd09c7be7ff7e6c50a4b8a7d7cf4507 --- M striker/templates/tools/membership/status.html M striker/tools/forms.py A striker/tools/migrations/0010_T168027.py M striker/tools/models.py M striker/tools/views/membership.py 5 files changed, 151 insertions(+), 30 deletions(-) Approvals: BryanDavis: Looks good to me, approved jenkins-bot: Verified diff --git a/striker/templates/tools/membership/status.html b/striker/templates/tools/membership/status.html index 412f6cf..9ac8fd2 100644 --- a/striker/templates/tools/membership/status.html +++ b/striker/templates/tools/membership/status.html @@ -33,16 +33,25 @@ {{ app.get_status_display }} {% trans "Reason" %} {{ app.reason|linebreaksbr }} -{% if app.admin_notes %} -{% trans "Notes" %} - {{ app.admin_notes|linebreaksbr }} -{% endif %} {% trans "Created" %} {{ app.created_date|date:"Y-m-d H:i" }} {% if app.resolved_date %} {% trans "Resolved" %} {{ app.resolved_date|date:"Y-m-d H:i" }} {{ app.resolved_by }} {% endif %} +{% if app.admin_notes %} +{% trans "Notes" %} +{{ app.admin_notes|linebreaksbr }} +{% endif %} +{% if app.comments.all %} +{% trans "Comments" %} +{% for comment in app.comments.all %} +{{ comment.comment|linebreaksbr }} +--{{ comment.user.ldapname }} +{{ comment.created_date|date:"Y-m-d H:i" }} + +{% endfor %} +{% endif %} diff --git a/striker/tools/forms.py b/striker/tools/forms.py index 1e596b6..31b47db 100644 --- a/striker/tools/forms.py +++ b/striker/tools/forms.py @@ -69,6 +69,7 @@ class AccessRequestForm(forms.ModelForm): +"""Form for creating a new access request.""" class Meta: model = AccessRequest fields = ('reason',) @@ -85,16 +86,35 @@ } -class AccessRequestAdminForm(forms.ModelForm): -class Meta: -model = AccessRequest -fields = ('admin_notes', 'status', 'suppressed') -widgets = { -'admin_notes': forms.Textarea( -attrs={ -'rows': 5, -}, -), +class AccessRequestCommentForm(AccessRequestForm): +"""Form for commenting on an access request.""" +comment = forms.CharField( +widget=forms.Textarea( +attrs={ +'placeholder': _('Add a publicly visible comment'), +'rows': 2, +}, +), +required=True, +) + +class Meta(AccessRequestForm.Meta): +fields = ('comment',) + + +class AccessRequestAdminForm(AccessRequestCommentForm): +"""Form for approving/denying an access request.""" + +def __init__(self, *args, **kwargs): +super(AccessRequestAdminForm, self).__init__(*args, **kwargs) +self.fields['comment'].required = False +self.fields['comment'].widget.is_required = False + +class Meta(AccessRequestCommentForm.Meta): +fields = ('status', 'comment', 'suppressed') +labels = { +'suppressed': _( +'Suppress this request (hide from non-admin users)'), } diff --git a/striker/tools/migrations/0010_T168027.py b/striker/tools/migrations/0010_T168027.py new file mode 100644 index 000..c99f9f7 --- /dev/null +++ b/striker/tools/migrations/0010_T168027.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone +from django.conf import settings + + +class Migration(migrations.Migration): + +dependencies = [ +migrations.swappable_dependency(settings.AUTH_USER_MODEL), +('tools', '0009_toolinfo_authors'), +] + +operations = [ +migrations.CreateModel( +name='AccessRequestComment', +fields=[ +('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)), +('created_date', models.DateTimeField(default=django.utils.timezone.now, db_index=True, editable=False, blank=True)), +('comment', models.TextField()), +], +options={ +'ordering': ('created_date', 'user'), +}, +), +migrations.AlterField( +
[MediaWiki-commits] [Gerrit] labs/striker[master]: Enhance workflow for tool labs membership requests
BryanDavis has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374104 ) Change subject: Enhance workflow for tool labs membership requests .. Enhance workflow for tool labs membership requests * Replace admin notes with timestamped comments. * Add "feedback needed" state for requests. * Change status from "pending" to "feedback needed" when admin comments without resolving. * Change status from "feedback needed" to "pending" when applicant replies. Bug: T168027 Change-Id: Ifa395b791dd09c7be7ff7e6c50a4b8a7d7cf4507 --- M striker/templates/tools/membership/status.html M striker/tools/forms.py A striker/tools/migrations/0010_T168027.py M striker/tools/models.py M striker/tools/views/membership.py 5 files changed, 151 insertions(+), 30 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/labs/striker refs/changes/04/374104/1 diff --git a/striker/templates/tools/membership/status.html b/striker/templates/tools/membership/status.html index 412f6cf..9ac8fd2 100644 --- a/striker/templates/tools/membership/status.html +++ b/striker/templates/tools/membership/status.html @@ -33,16 +33,25 @@ {{ app.get_status_display }} {% trans "Reason" %} {{ app.reason|linebreaksbr }} -{% if app.admin_notes %} -{% trans "Notes" %} - {{ app.admin_notes|linebreaksbr }} -{% endif %} {% trans "Created" %} {{ app.created_date|date:"Y-m-d H:i" }} {% if app.resolved_date %} {% trans "Resolved" %} {{ app.resolved_date|date:"Y-m-d H:i" }} {{ app.resolved_by }} {% endif %} +{% if app.admin_notes %} +{% trans "Notes" %} +{{ app.admin_notes|linebreaksbr }} +{% endif %} +{% if app.comments.all %} +{% trans "Comments" %} +{% for comment in app.comments.all %} +{{ comment.comment|linebreaksbr }} +--{{ comment.user.ldapname }} +{{ comment.created_date|date:"Y-m-d H:i" }} + +{% endfor %} +{% endif %} diff --git a/striker/tools/forms.py b/striker/tools/forms.py index 97c946f..ef359a8 100644 --- a/striker/tools/forms.py +++ b/striker/tools/forms.py @@ -69,6 +69,7 @@ class AccessRequestForm(forms.ModelForm): +"""Form for creating a new access request.""" class Meta: model = AccessRequest fields = ('reason',) @@ -85,16 +86,35 @@ } -class AccessRequestAdminForm(forms.ModelForm): -class Meta: -model = AccessRequest -fields = ('admin_notes', 'status', 'suppressed') -widgets = { -'admin_notes': forms.Textarea( -attrs={ -'rows': 5, -}, -), +class AccessRequestCommentForm(AccessRequestForm): +"""Form for commenting on an access request.""" +comment = forms.CharField( +widget=forms.Textarea( +attrs={ +'placeholder': _('Add a publicly visible comment'), +'rows': 2, +}, +), +required=True, +) + +class Meta(AccessRequestForm.Meta): +fields = ('comment',) + + +class AccessRequestAdminForm(AccessRequestCommentForm): +"""Form for approving/denying an access request.""" + +def __init__(self, *args, **kwargs): +super(AccessRequestAdminForm, self).__init__(*args, **kwargs) +self.fields['comment'].required = False +self.fields['comment'].widget.is_required = False + +class Meta(AccessRequestCommentForm.Meta): +fields = ('status', 'comment', 'suppressed') +labels = { +'suppressed': _( +'Suppress this request (hide from non-admin users)'), } diff --git a/striker/tools/migrations/0010_T168027.py b/striker/tools/migrations/0010_T168027.py new file mode 100644 index 000..c99f9f7 --- /dev/null +++ b/striker/tools/migrations/0010_T168027.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone +from django.conf import settings + + +class Migration(migrations.Migration): + +dependencies = [ +migrations.swappable_dependency(settings.AUTH_USER_MODEL), +('tools', '0009_toolinfo_authors'), +] + +operations = [ +migrations.CreateModel( +name='AccessRequestComment', +fields=[ +('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)), +('created_date', models.DateTimeField(default=django.utils.timezone.now, db_index=True, editable=False, blank=True)), +('comment', models.TextField()), +], +options={ +'ordering': ('created_date', 'user'), +}, +), +migrations.AlterField( +