Support user and team preferences (#4081)

* feat: support user preferences

* feat: support team preferences

* fix: update snapshots

* feat: update last visited url by user

* fix: update snapshots

* fix: use path instead of complete url

* fix: do not expose preferences to other users with the exception of admin

* feat: support defaultDocumentStatus as a team preference

* feat: allow edit even when collaborative editing is enabled

* Revert "feat: allow edit even when collaborative editing is enabled"

This reverts commit a22a02a406d01eb418dab32249b8b846bf77c59b.

* Revert "feat: support defaultDocumentStatus as a team preference"

This reverts commit 4928cffe5c682952b1e469a3e50a1a34d05dcc58.

* fix: keep preference as a boolean
This commit is contained in:
Apoorv Mishra
2022-09-14 16:07:39 +05:30
committed by GitHub
parent 607a795dd0
commit ce410c4bf3
10 changed files with 171 additions and 3 deletions

View File

@@ -393,6 +393,46 @@ describe("#users.update", () => {
expect(body.data.name).toEqual("New name");
});
it("should fail upon sending invalid user preference", async () => {
const { user } = await seed();
const res = await server.post("/api/users.update", {
body: {
token: user.getJwtToken(),
name: "New name",
preferences: { invalidPreference: "invalidValue" },
},
});
expect(res.status).toEqual(400);
});
it("should fail upon sending invalid user preference value", async () => {
const { user } = await seed();
const res = await server.post("/api/users.update", {
body: {
token: user.getJwtToken(),
name: "New name",
preferences: { rememberLastPath: "invalidValue" },
},
});
expect(res.status).toEqual(400);
});
it("should update rememberLastPath user preference", async () => {
const { user } = await seed();
const res = await server.post("/api/users.update", {
body: {
token: user.getJwtToken(),
name: "New name",
preferences: {
rememberLastPath: true,
},
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.preferences.rememberLastPath).toBe(true);
});
it("should require authentication", async () => {
const res = await server.post("/api/users.update");
const body = await res.json();