mirror of
https://github.com/outline/outline.git
synced 2026-11-22 14:01:41 +03:00
fix: if user is viewer at workspace level, they should have only read perm by default on a doc
This commit is contained in:
1 parent
33f0e1c2af
commit
dcc90e14fb
3 files changed
+2
-6
No files matched your search
@@ -5,7 +5,6 @@ import * as React from "react";
|
||||
import { toast } from "sonner";
|
||||
import styled from "styled-components";
|
||||
import { Pagination } from "@shared/constants";
|
||||
import { DocumentPermission } from "@shared/types";
|
||||
import Document from "~/models/Document";
|
||||
import User from "~/models/User";
|
||||
import UserMembership from "~/models/UserMembership";
|
||||
@@ -66,7 +65,6 @@ function InviteTeamMembers({ document }: Props) {
|
||||
userMemberships.create({
|
||||
documentId: document.id,
|
||||
userId: user.id,
|
||||
permission: DocumentPermission.ReadWrite,
|
||||
}),
|
||||
[userMemberships, document.id]
|
||||
);
|
||||
|
||||
@@ -1501,7 +1501,7 @@ router.post(
|
||||
},
|
||||
{ transaction }
|
||||
);
|
||||
} else {
|
||||
} else if (permission) {
|
||||
membership.permission = permission;
|
||||
await membership.save({ transaction });
|
||||
}
|
||||
|
||||
@@ -362,9 +362,7 @@ export const DocumentsAddUserSchema = BaseSchema.extend({
|
||||
/** Id of the user who is to be added*/
|
||||
userId: z.string().uuid(),
|
||||
/** Permission to be granted to the added user */
|
||||
permission: z
|
||||
.nativeEnum(DocumentPermission)
|
||||
.default(DocumentPermission.ReadWrite),
|
||||
permission: z.nativeEnum(DocumentPermission).optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user