Package: nm.debian.org
Severity: minor
Tags: patch

Text for approved requirements is incomplete:
It shows "This requirement has been approved by ago.",
when it should eg. show 
"This requirement has been approved by Housekeeping Robot 
<nm_debian....@example.org> 7 months, 2 weeks ago."

Added a patch for using '{% blocktrans with variable_name=something %}' syntax 
for requirement_status_widget.html and for a few other templates from process/
templates/process/
>From 34caf407ea85b6042490c761e191a5d045f261cb Mon Sep 17 00:00:00 2001
From: Judit Foglszinger <ur...@debian.org>
Date: Mon, 2 Mar 2020 08:01:14 +0600
Subject: [PATCH] use 'with' in blocktrans for variable substitution

---
 process/templates/process/cancel.html                 | 11 ++++++-----
 .../templates/process/requirement_status_widget.html  |  6 +++---
 process/templates/process/show.html                   |  1 +
 process/templates/process/statement_create.html       |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/process/templates/process/cancel.html b/process/templates/process/cancel.html
index 755843d..8ef2d9a 100644
--- a/process/templates/process/cancel.html
+++ b/process/templates/process/cancel.html
@@ -1,4 +1,5 @@
 {% extends "process/nm2-base.html" %}
+{% load nm %}
 {% load i18n %}
 
 {% block content %}
@@ -14,12 +15,12 @@ system. Follow the link for instructions.{% endblocktrans %}
 {% else %}
 
 {% if process.applying_for == "dd_e" %} 
-  <p>{% blocktrans %}On {{process.started|date:"F d, Y"}} the
+  <p>{% blocktrans with started_on=process.started|date:"F d, Y" person_ldap_uid=process.person.ldap_fields.uid %}On {{started_on}} the
 <a href="https://wiki.debian.org/qa.debian.org/MIATeam";>Missing In Action</a>
-team sent a "Where Are Thou?" ping message to <tt>{{process.person.ldap_fields.uid}}</tt>
+team sent a "Where Are Thou?" ping message to <tt>{{person_ldap_uid}}</tt>
 communicating the intention of closing the account after some time.</p>{% endblocktrans %}
   
-  <p>{% blocktrans %}If you are {{process.person.fullname}} and consider
+  <p>{% blocktrans with person_fullname=person.fullname %}If you are {{person_fullname}} and consider
 yourself still active, you can use this page to let the MIA team know.{% endblocktrans %}</p>
 
   {% if not process.person.fpr %}
@@ -34,8 +35,8 @@ in the Debian keyring.{% endblocktrans %}</p>
 what you do or are going to do in Debian. The text will only be visible to
 Front Desk / MIA team unless you tick the box to make it public.{% endblocktrans %}</p>
 {% else %}
-  <p>{% blocktrans %}By submitting this form you can cancel the process for
-becoming {{ process.applying_for|desc_status }} started on {{process.started|date:'F d, Y'}}.{% endblocktrans %}</p>
+  <p>{% blocktrans with applying_for=process.applying_for|desc_status started_on=process.started|date:'F d, Y' %}By submitting this form you can cancel the process for
+becoming {{ applying_for }} started on {{started_on}}.{% endblocktrans %}</p>
 {% endif %}
 
 
diff --git a/process/templates/process/requirement_status_widget.html b/process/templates/process/requirement_status_widget.html
index acc8dde..9469195 100644
--- a/process/templates/process/requirement_status_widget.html
+++ b/process/templates/process/requirement_status_widget.html
@@ -1,9 +1,9 @@
 {% load i18n %}
 
 {% if requirement.approved_by %}
-  <p><i>{% blocktrans %}This requirement has been approved by
-<a href="{{requirement.approved_by.get_absolute_url}}">{{requirement.approved_by}}</a>
-{{requirement.approved_time|timesince}} ago.{% endblocktrans %}</i></p>
+  <p><i>{% blocktrans with req_approved_by_absolute_url=requirement.approved_by.get_absolute_url req_approved_by=requirement.approved_by requirement_approved_time=requirement.approved_time|timesince%}This
+requirement has been approved by <a href="{{req_approved_by_absolute_url}}">{{req_approved_by}}</a>
+{{requirement_approved_time}} ago.{% endblocktrans %}</i></p>
 {% else %}
   {% if status.satisfied %}
   <p><i>{% trans "This requirement looks ready for approval, but has not been approved yet." %}</i></p>
diff --git a/process/templates/process/show.html b/process/templates/process/show.html
index 27835ef..042faa0 100644
--- a/process/templates/process/show.html
+++ b/process/templates/process/show.html
@@ -187,6 +187,7 @@ but not frozen for review.{% endblocktrans %}
   </tr>
 
   {% comment %} TODO: Requires porting stats backend to new Process
+  NOTE: blocktrans needs to be adjusted to use syntax {% blocktrans with name=something%} {{name}}...
   {% if mbox_stats %}
   <tr><th>{% trans "Mailbox stats" %}</th>
       <td>{% blocktrans %}{{mbox_stats.date_first_py|date:"Y-m-d"}} to {{mbox_stats.date_last_py|date:"Y-m-d"}},
diff --git a/process/templates/process/statement_create.html b/process/templates/process/statement_create.html
index a7ad20d..175db73 100644
--- a/process/templates/process/statement_create.html
+++ b/process/templates/process/statement_create.html
@@ -28,7 +28,7 @@ a need of manual validation of its content:{% endblocktrans %}</p>
 </pre>
 {% endif %}
 
-<p>{% blocktrans %}Use <tt>gpg --clearsign --default-key {{visitor.fpr}}</tt>
+<p>{% blocktrans with visitor_fpr=visitor.fpr%}Use <tt>gpg --clearsign --default-key {{visitor_fpr}}</tt>
 to generate the signed statement. Tip: pipe it to <tt>xclip</tt> to have it
 copied to the clipboard for easy pasting.{% endblocktrans %}</p>
 
-- 
2.25.0

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to