Skip to content

Commit 2d40ccc

Browse files
authored
Release v1.56.4 (#1356)
- fix(formsg-frontend): table field preview - fix(pipe-transfer): filter excel steps to nullify - chore(slack): reduce Slack scopes
2 parents b826f09 + 2ae1126 commit 2d40ccc

File tree

13 files changed

+87
-89
lines changed

13 files changed

+87
-89
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@
111111
"tsconfig-paths": "^4.2.0",
112112
"type-fest": "4.10.3"
113113
},
114-
"version": "1.56.3"
114+
"version": "1.56.4"
115115
}

packages/backend/src/apps/formsg/triggers/new-submission/get-data-out-metadata.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ function buildTableMetadatum(fieldData: IJSONObject): IDataOutMetadata {
204204

205205
const tableObject = JSON.parse(fieldData.answer as string)
206206
return {
207-
label: `Response ${fieldData.order}`,
207+
label: fieldData.question
208+
? `${fieldData.order}. ${fieldData.question}`
209+
: `Response ${fieldData.order}`,
208210
order: fieldData.order ? (fieldData.order as number) + 0.1 : null,
209211
type: 'table',
210212
displayedValue: `Preview ${tableObject.rows.length} row(s)`,

packages/backend/src/apps/formsg/triggers/new-submission/get-mock-data.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type FormField = {
1313
_id: string
1414
columns?: Array<{
1515
_id: string
16+
title?: string
1617
}>
1718
fieldType: string
1819
fieldOptions?: string[]
@@ -130,8 +131,9 @@ async function getMockData($: IGlobalVariable) {
130131
data.responses[formFields[i]._id].answer = 'Signature captured' // mock this to always be present regardless of whether the user has signed or not
131132
}
132133

133-
// formsg payload doesnt contain this anyways, so we dont return in mock data
134-
if (fieldType === 'statement') {
134+
// formsg payload doesnt contain these fields anyways, so we dont return in mock data
135+
// this ensures that the question numbering remains consistent with the actual submission
136+
if (fieldType === 'statement' || fieldType === 'image') {
135137
delete data.responses[formFields[i]._id]
136138
continue
137139
}
@@ -160,11 +162,21 @@ async function getMockData($: IGlobalVariable) {
160162
if (fieldType === 'table') {
161163
const answerArray = data.responses[formFields[i]._id]
162164
.answerArray as string[][]
163-
const question = data.responses[formFields[i]._id].question
165+
const question = `${
166+
data.responses[formFields[i]._id].question
167+
} (${formFields[i].columns
168+
?.map((column, index) => column?.title ?? `Col ${index + 1}`)
169+
.join(', ')})`
170+
171+
data.responses[formFields[i]._id].question = question
164172
data.responses[formFields[i]._id].answer =
165173
convertTableAnswerArrayToTableObject(question, answerArray)
166174
}
167175

176+
if (fieldType === 'section' || fieldType === 'image') {
177+
data.responses[formFields[i]._id].answer = ''
178+
}
179+
168180
data.responses[formFields[i]._id].order = i + 1
169181
data.responses[formFields[i]._id].id = undefined
170182
}

packages/backend/src/apps/slack/auth/generate-auth-url.ts

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,8 @@ import type {
66

77
import qs from 'qs'
88

9-
const scopes = [
10-
'channels:manage',
11-
'channels:read',
12-
'channels:join',
13-
'chat:write',
14-
'chat:write.customize',
15-
'chat:write.public',
16-
'files:write',
17-
'im:write',
18-
'mpim:write',
19-
'team:read',
20-
'users.profile:read',
21-
'users:read',
22-
'workflow.steps:execute',
23-
'users:read.email',
24-
'commands',
25-
]
26-
const userScopes = [
27-
'channels:history',
28-
'channels:read',
29-
'channels:write',
30-
'chat:write',
31-
'emoji:read',
32-
'files:read',
33-
'files:write',
34-
'groups:history',
35-
'groups:read',
36-
'groups:write',
37-
'im:write',
38-
'mpim:write',
39-
'reactions:read',
40-
'reminders:write',
41-
'search:read',
42-
'stars:read',
43-
'team:read',
44-
'users.profile:read',
45-
'users.profile:write',
46-
'users:read',
47-
'users:read.email',
48-
]
9+
const scopes = ['chat:write', 'chat:write.customize', 'chat:write.public']
10+
const userScopes = ['channels:read', 'chat:write', 'search:read', 'users:read']
4911

5012
export default async function generateAuthUrl($: IGlobalVariable) {
5113
// Our own auth, so safe to cast $.app.auth

packages/backend/src/apps/slack/auth/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const auth: IUserAddedConnectionAuth = {
2222
},
2323
{
2424
key: 'consumerKey',
25-
label: 'API Key',
25+
label: 'Client ID',
2626
type: 'string' as const,
2727
required: true,
2828
readOnly: false,
@@ -33,7 +33,7 @@ const auth: IUserAddedConnectionAuth = {
3333
},
3434
{
3535
key: 'consumerSecret',
36-
label: 'API Secret',
36+
label: 'Client Secret',
3737
type: 'string' as const,
3838
required: true,
3939
readOnly: false,

packages/backend/src/graphql/mutations/update-flow-transfer-status.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ const updateFlowTransferStatus: MutationResolvers['updateFlowTransferStatus'] =
103103
// nullify connections for M365-excel
104104
// excel connections cannot be shared; the new owner should use their own connection
105105
const excelStepIds = flow.steps
106-
.filter((step) => step.appKey === 'm365-excel')
106+
.filter(
107+
(step) => step.appKey === 'm365-excel' && step.connectionId != null,
108+
)
107109
.map((step) => step.id)
108110
const numExcelNullified = await Step.query(trx)
109111
.patch({ connection: null, connectionId: null, status: 'incomplete' })

packages/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend",
3-
"version": "1.56.3",
3+
"version": "1.56.4",
44
"type": "module",
55
"scripts": {
66
"dev": "wait-on tcp:3000 && vite --host --force",

packages/frontend/src/components/VariablesList/TableVariableItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default function TableVariableItem(props: TableVariableItemProps) {
3333
/>
3434
{!onClick && (
3535
<TableVariableModal
36+
variableId={variable.name}
3637
isOpen={isOpen}
3738
onClose={onClose}
3839
currentExecutionStep={currentTestExecutionStep}

packages/frontend/src/components/VariablesList/TableVariableModal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ interface TableVariableModalProps {
2828
isOpen: boolean
2929
onClose: () => void
3030
currentExecutionStep?: IExecutionStep | null
31+
// variableName is the step variable: `step.<uuid>.xxxxx`
32+
variableId: string
3133
}
3234

3335
const TableHeader = ({ columns }: { columns: ProcessedColumn[] }) => (
@@ -107,12 +109,15 @@ const TableRow = ({
107109
)
108110

109111
export default function TableVariableModal(props: TableVariableModalProps) {
110-
const { isOpen, onClose, currentExecutionStep } = props
112+
const { isOpen, onClose, currentExecutionStep, variableId } = props
111113

112114
if (!currentExecutionStep) {
113115
return null
114116
}
115-
const { rowsFound, dataRows, columns } = processData(currentExecutionStep)
117+
const { rowsFound, dataRows, columns } = processData(
118+
currentExecutionStep,
119+
variableId,
120+
)
116121

117122
return (
118123
<Modal

0 commit comments

Comments
 (0)