Skip to content

Commit

Permalink
fix: rename change permission (#2481)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybzky authored Jun 12, 2024
1 parent bbb49a8 commit ee6a464
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export function FormulaBar() {
const subUnitId = worksheet.getSheetId();
const range = selectionManager.getLast()?.range;
if (!range) return;
const worksheetSetCellValuePermission = permissionService.getPermissionPoint(new WorksheetSetCellValuePermission(unitId, subUnitId).id);
const worksheetEditPermission = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id);
const worksheetSetCellValuePermission = permissionService.getPermissionPoint(new WorksheetSetCellValuePermission(unitId, subUnitId).id)?.value;
const worksheetEditPermission = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)?.value;

if (!worksheetSetCellValuePermission || !worksheetEditPermission) {
setDisable(true);
Expand Down Expand Up @@ -94,7 +94,7 @@ export function FormulaBar() {
}
}
);
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const INITIAL_SNAPSHOT = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.sheet-permission-user-dialog-wrapper {
height: 329px;
padding: var(--padding-base);
box-sizing: content-box;
}

.sheet-permission-user-dialog-search {
Expand Down
10 changes: 6 additions & 4 deletions packages/sheets-ui/src/views/sheet-bar/SheetBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import type { Workbook } from '@univerjs/core';
import { ICommandService, IPermissionService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { IncreaseSingle, MoreSingle } from '@univerjs/icons';
import { InsertSheetCommand, WorkbookEditablePermission } from '@univerjs/sheets';
import { InsertSheetCommand, WorkbookCreateSheetPermission, WorkbookEditablePermission } from '@univerjs/sheets';
import { useDependency } from '@wendellhu/redi/react-bindings';
import React, { useEffect, useState } from 'react';

Expand Down Expand Up @@ -56,9 +56,11 @@ export const SheetBar = () => {
}, []);

useEffect(() => {
const subscription = permissionService.getPermissionPoint$(new WorkbookEditablePermission(unitId)?.id)?.pipe(
map((permission) => permission?.value ?? false)
)?.subscribe((permission) => {
const composePermission$ = permissionService.composePermission$([new WorkbookEditablePermission(unitId)?.id, new WorkbookCreateSheetPermission(unitId)?.id])?.pipe(
map((permissions) => permissions?.every((permission) => permission?.value ?? false))
);

const subscription = composePermission$?.subscribe((permission) => {
setEditPermission(permission ?? false);
});

Expand Down

0 comments on commit ee6a464

Please sign in to comment.