🛂(frontend) block editing title when not allowed
We had a case where the title input was editable even when the user did not have the right to edit it because of websocket problem during collaboration. We fixed this issue by checking the collaboration status before allowing the edition of the title.
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
KEY_DOC,
|
||||
KEY_LIST_DOC,
|
||||
useDocStore,
|
||||
useIsCollaborativeEditable,
|
||||
useTrans,
|
||||
useUpdateDoc,
|
||||
} from '@/docs/doc-management';
|
||||
@@ -21,7 +22,10 @@ interface DocTitleProps {
|
||||
}
|
||||
|
||||
export const DocTitle = ({ doc }: DocTitleProps) => {
|
||||
if (!doc.abilities.partial_update) {
|
||||
const { isEditable, isLoading } = useIsCollaborativeEditable(doc);
|
||||
const readOnly = !doc.abilities.partial_update || !isEditable || isLoading;
|
||||
|
||||
if (readOnly) {
|
||||
return <DocTitleText />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user