Skip to content

Commit

Permalink
feat: rename "Reference Number" to "Response ID" (opengovsg#2277)
Browse files Browse the repository at this point in the history
* feat: update response email subject to use #

* feat: update response email body to use Response ID

* feat: update storage mode Data tab to use Response ID

* feat: update storage mode CSV to use Response ID

* feat: update email confirmation PDF to use Response ID

* build: empty commit to trigger build
  • Loading branch information
mantariksh authored Jul 1, 2021
1 parent 6e3147b commit 605046e
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/app/modules/bounce/__tests__/bounce-test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const makeEmailNotification = (
},
],
commonHeaders: {
subject: `Title (Ref: ${submissionId})`,
subject: `Title (#${submissionId})`,
to: recipientList,
from: '[email protected]',
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/mail/__tests__/mail.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ describe('mail.service', () => {
// Should include the metadata in the front.
const EXPECTED_JSON_DATA = [
{
question: 'Reference Number',
question: 'Response ID',
answer: MOCK_VALID_SUBMISSION_PARAMS.submission.id,
},
{
Expand All @@ -410,7 +410,7 @@ describe('mail.service', () => {
return {
to: toField,
from: MOCK_SENDER_STRING,
subject: `formsg-auto: ${MOCK_VALID_SUBMISSION_PARAMS.form.title} (Ref: ${MOCK_VALID_SUBMISSION_PARAMS.submission.id})`,
subject: `formsg-auto: ${MOCK_VALID_SUBMISSION_PARAMS.form.title} (#${MOCK_VALID_SUBMISSION_PARAMS.submission.id})`,
html: expectedHtml,
attachments: MOCK_VALID_SUBMISSION_PARAMS.attachments,
headers: {
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/mail/mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export class MailService {
// Unshift is not used as it mutates the array.
const fullDataCollationData = [
{
question: 'Reference Number',
question: 'Response ID',
answer: refNo,
},
{
Expand All @@ -476,7 +476,7 @@ export class MailService {
const mail: MailOptions = {
to: form.emails,
from: this.#senderFromString,
subject: `formsg-auto: ${formTitle} (Ref: ${refNo})`,
subject: `formsg-auto: ${formTitle} (#${refNo})`,
html: mailHtml,
attachments,
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/views/templates/submit-form-email.server.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
>
<tbody>
<tr style="border-top: 1px solid #eee">
<td width="40%"><strong>Reference Number</strong></td>
<td width="40%"><strong>Response ID</strong></td>
<td><%= refNo %></td>
</tr>
<tr style="border-top: 1px solid #eee">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<% } %>
<tr style="border-top: 1px solid #eee;">
<td class="key-cell" width="50%" style="vertical-align: top;">
<strong>Reference Number</strong>
<strong>Response ID</strong>
</td>
<td class="value-cell">
<%= refNo %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
{{row.number}}
</td>
<td
title="'Ref no.'"
title="'Response ID'"
class="refNo-col"
header-class="'refNo-col'"
>
Expand All @@ -182,8 +182,8 @@
/>
<div class="title">No results found</div>
<div class="subtitle">
Did you enter the right reference number? We can't seem to find
the response.
Did you enter the right response ID? We can't seem to find the
response.
</div>
</div>
</div>
Expand Down Expand Up @@ -227,7 +227,7 @@
<div id="respondent-timestamp">
<div class="row">
<div class="col-xs-12 col-sm-4">
<b>Reference number</b>
<b>Response ID</b>
</div>
<div class="col-xs-12 col-sm-8">{{ vm.decryptedResponse.refNo }}</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class CsvMergedHeadersGenerator extends CsvGenerator {
if (this.hasBeenProcessed) return

// Create a header row in CSV using the fieldIdToQuestion map.
const headers = ['Reference number', 'Timestamp']
const headers = ['Response ID', 'Timestamp']
this.fieldIdToQuestion.forEach((value, fieldId) => {
for (let i = 0; i < this.fieldIdToNumCols[fieldId]; i++) {
headers.push(value.question)
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/helpers/email-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const verifySubmission = async (t, testFormData, authData) => {
await t.expect(from).eql('FormSG <[email protected]>')

// Verify subject of email
await t.expect(subject).contains(`formsg-auto: ${title} (Ref:`)
await t.expect(subject).contains(`formsg-auto: ${title} (#`)
// Verify form content in email
for (let field of formFields) {
const contained = [
Expand All @@ -66,7 +66,7 @@ const verifySubmission = async (t, testFormData, authData) => {
await t.expect(emailJSONStr).notEql(null)
const emailJSON = JSON.parse(decodeHtmlEntities(emailJSONStr))
const response = emailJSON.filter(
({ question }) => !/(Reference Number|Timestamp)/.test(question),
({ question }) => !/(Response ID|Timestamp)/.test(question),
)
await t.expect(response.length).notEql(0)
let rowIdx = 0 // A table could result in multiple rows of answers, so there might be more answers than form fields
Expand Down
9 changes: 4 additions & 5 deletions tests/end-to-end/helpers/encrypt-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ngrok = require('ngrok')
// Index of the column headers in the exported CSV. The first 4 rows are
// metadata about the number of responses decrypted.
const CSV_HEADER_ROW_INDEX = 5
// The first two columns are "Reference number" and "Timestamp", so the
// The first two columns are "Response ID" and "Timestamp", so the
// fields to check only start from the third column.
const CSV_ANSWER_COL_INDEX = 3

Expand Down Expand Up @@ -131,13 +131,12 @@ async function checkDownloadCsv(t, formData, authData, formId) {
`${getDownloadsFolder()}/${formOptions.title}-${formId}.csv`,
)
const records = parse(csvContent, { relax_column_count: true })
const headers = ['Reference number', 'Timestamp', 'Download Status']
const headers = ['Response ID', 'Timestamp', 'Download Status']
const answers = []
formFields.forEach((field) => addExpectedCsvResponse(field, headers, answers))
await t.expect(records[CSV_HEADER_ROW_INDEX]).eql(headers)
const actualAnswers = records[CSV_HEADER_ROW_INDEX + 1].slice(
CSV_ANSWER_COL_INDEX,
)
const actualAnswers =
records[CSV_HEADER_ROW_INDEX + 1].slice(CSV_ANSWER_COL_INDEX)
await t.expect(actualAnswers).eql(answers)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ describe('CsvMergedHeadersGenerator', () => {
// Should have 1 header row and 1 submission row
expect(generator.records.length).toEqual(2 + BOM_LENGTH)
const expectedHeaderRow = stringify([
'Reference number',
'Response ID',
'Timestamp',
mockDecryptedRecord[0].question,
mockDecryptedRecord[1].question,
Expand Down Expand Up @@ -420,7 +420,7 @@ describe('CsvMergedHeadersGenerator', () => {
// Should have 1 header row and 2 submission row
expect(generator.records.length).toEqual(3 + BOM_LENGTH)
const expectedHeaderRow = stringify([
'Reference number',
'Response ID',
'Timestamp',
mockFirstDecryptedRecord[0].question,
mockFirstDecryptedRecord[1].question,
Expand Down Expand Up @@ -493,7 +493,7 @@ describe('CsvMergedHeadersGenerator', () => {
// Should have 1 header row and 2 submission row
expect(generator.records.length).toEqual(3 + BOM_LENGTH)
const expectedHeaderRow = stringify([
'Reference number',
'Response ID',
'Timestamp',
mockDecryptedRecord[0].question,
mockDecryptedRecord[1].question,
Expand Down Expand Up @@ -561,7 +561,7 @@ describe('CsvMergedHeadersGenerator', () => {
// Should have 1 header row and 1 submission row
expect(generator.records.length).toEqual(2 + BOM_LENGTH)
const expectedHeaderRow = stringify([
'Reference number',
'Response ID',
'Timestamp',
mockDecryptedRecord[0].question,
])
Expand Down Expand Up @@ -609,7 +609,7 @@ describe('CsvMergedHeadersGenerator', () => {
expect(generator.records.length).toEqual(2 + BOM_LENGTH)
// Question is repeated for two columns
const expectedHeaderRow = stringify([
'Reference number',
'Response ID',
'Timestamp',
mockDecryptedRecord[0].question,
mockDecryptedRecord[0].question,
Expand Down Expand Up @@ -656,7 +656,7 @@ describe('CsvMergedHeadersGenerator', () => {
// Should have 1 header row and 2 submission rows
expect(generator.records.length).toEqual(3 + BOM_LENGTH)
const expectedHeaderRow = stringify([
'Reference number',
'Response ID',
'Timestamp',
mockAnswerArray[0].question,
])
Expand Down

0 comments on commit 605046e

Please sign in to comment.