@budibase/worker 3.29.0 → 3.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "3.29.0",
4
+ "version": "3.30.0",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -109,5 +109,5 @@
109
109
  }
110
110
  }
111
111
  },
112
- "gitHead": "d16e42b03ed3e4e7e1c1b055810fa54879aa8706"
112
+ "gitHead": "58456cc695d2c71a354bcf5c064943b247ad4969"
113
113
  }
@@ -87,6 +87,24 @@ describe("/api/global/users", () => {
87
87
  expect(events.user.invited).toHaveBeenCalledTimes(0)
88
88
  })
89
89
 
90
+ it("should not invite the same user twice when email casing differs", async () => {
91
+ const email = structures.users.newEmail().toLowerCase()
92
+ await config.api.users.sendUserInvite(sendMailMock, email)
93
+
94
+ jest.clearAllMocks()
95
+
96
+ const { code, res } = await config.api.users.sendUserInvite(
97
+ sendMailMock,
98
+ email.toUpperCase(),
99
+ 400
100
+ )
101
+
102
+ expect(res.body.message).toBe(`Unavailable`)
103
+ expect(sendMailMock).toHaveBeenCalledTimes(0)
104
+ expect(code).toBeUndefined()
105
+ expect(events.user.invited).toHaveBeenCalledTimes(0)
106
+ })
107
+
90
108
  it("should not allow creator users to access single invite endpoint", async () => {
91
109
  const user = await createBuilderUser()
92
110
 
@@ -22,7 +22,7 @@ export async function invite(
22
22
 
23
23
  // separate duplicates from new users
24
24
  for (let user of users) {
25
- if (matchedEmails.includes(user.email)) {
25
+ if (matchedEmails.includes(user.email.toLowerCase())) {
26
26
  // This "Unavailable" is load bearing. The tests and frontend both check for it
27
27
  // specifically
28
28
  response.unsuccessful.push({ email: user.email, reason: "Unavailable" })