Skip to content

Commit 86a6cf4

Browse files
committed
Merge branch 'develop-v2' into chore/vault/throw-errors
2 parents 9c76758 + b39bea4 commit 86a6cf4

File tree

43 files changed

+846
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+846
-397
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
@@ -105,5 +105,5 @@
105105
"tsconfig-paths": "^4.2.0",
106106
"type-fest": "4.10.3"
107107
},
108-
"version": "1.29.3"
108+
"version": "1.29.5"
109109
}

packages/backend/src/apps/tiles/__tests__/actions/create-row.itest.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ describe('tiles create row action', () => {
7373
expect($.setActionItem).toBeCalled()
7474
})
7575

76-
it('should now allow non-owners to create row', async () => {
77-
$.user = viewer
78-
await expect(createRowAction.run($)).rejects.toThrow(StepError)
76+
it('should allow editors to create row', async () => {
7977
$.user = editor
78+
await expect(createRowAction.run($)).resolves.toBeUndefined()
79+
expect($.setActionItem).toBeCalled()
80+
})
81+
82+
it('should not allow viewers to create row', async () => {
83+
$.user = viewer
8084
await expect(createRowAction.run($)).rejects.toThrow(StepError)
8185
})
8286
})

packages/backend/src/apps/tiles/__tests__/actions/find-single-row.itest.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ describe('tiles create row action', () => {
8181
expect($.setActionItem).toBeCalled()
8282
})
8383

84-
it('should now allow non-owners to find single row', async () => {
85-
$.user = viewer
86-
await expect(findSingleRowAction.run($)).rejects.toThrow(StepError)
84+
it('should allow editors to find single row', async () => {
8785
$.user = editor
86+
await expect(findSingleRowAction.run($)).resolves.toBeUndefined()
87+
expect($.setActionItem).toBeCalled()
88+
})
89+
90+
it('should not allow viewers to find single row', async () => {
91+
$.user = viewer
8892
await expect(findSingleRowAction.run($)).rejects.toThrow(StepError)
8993
})
9094
})

packages/backend/src/apps/tiles/__tests__/actions/update-row.itest.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ describe('tiles create row action', () => {
8282
expect($.setActionItem).toBeCalled()
8383
})
8484

85-
it('should now allow non-owners to update row', async () => {
86-
$.user = viewer
87-
await expect(updateRowAction.run($)).rejects.toThrow(StepError)
85+
it('should allow editors to update row', async () => {
8886
$.user = editor
87+
await expect(updateRowAction.run($)).resolves.toBeUndefined()
88+
expect($.setActionItem).toBeCalled()
89+
})
90+
91+
it('should not allow viewers to update row', async () => {
92+
$.user = viewer
8993
await expect(updateRowAction.run($)).rejects.toThrow(StepError)
9094
})
9195
})

packages/backend/src/apps/tiles/actions/create-row/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const action: IRawAction = {
9494
rowData: { columnId: string; cellValue: string }[]
9595
}
9696

97-
await TableCollaborator.hasAccess($.user?.id, tableId, 'owner', $)
97+
await TableCollaborator.hasAccess($.user?.id, tableId, 'editor', $)
9898

9999
const table = await TableMetadata.query().findById(tableId)
100100

packages/backend/src/apps/tiles/actions/find-single-row/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const action: IRawAction = {
149149
returnLastRow: boolean | undefined
150150
}
151151

152-
await TableCollaborator.hasAccess($.user?.id, tableId, 'owner', $)
152+
await TableCollaborator.hasAccess($.user?.id, tableId, 'editor', $)
153153

154154
const columns = await TableColumnMetadata.query().where({
155155
table_id: tableId,

packages/backend/src/apps/tiles/actions/update-row/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const action: IRawAction = {
108108
)
109109
}
110110

111-
await TableCollaborator.hasAccess($.user?.id, tableId, 'owner', $)
111+
await TableCollaborator.hasAccess($.user?.id, tableId, 'editor', $)
112112

113113
/**
114114
* Row ID is empty, this could be because the previous get single row action

packages/backend/src/apps/tiles/dynamic-data/list-columns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const dynamicData: IDynamicData = {
2525
const tile = await currentUser
2626
.$relatedQuery('tables')
2727
.findById($.step.parameters.tableId as string)
28-
.where('role', 'owner')
28+
.whereIn('role', ['owner', 'editor'])
2929
.throwIfNotFound()
3030
const columns = await tile
3131
.$relatedQuery('columns')

packages/backend/src/apps/tiles/dynamic-data/list-tables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const dynamicData: IDynamicData = {
1919
const currentUser = await User.query().findById($.user.id)
2020
const tiles = await currentUser
2121
.$relatedQuery('tables')
22-
.where('role', 'owner')
22+
.whereIn('role', ['owner', 'editor'])
2323
.orderBy('created_at', 'desc')
2424

2525
return {

0 commit comments

Comments
 (0)