Правки #16
@@ -15,6 +15,7 @@ import {
|
||||
} from '../../shared/approval';
|
||||
import { friendlyErrorMessage } from '../../shared/diagnostics';
|
||||
import { getManagerEmail } from '../../shared/dictionary';
|
||||
import { effectiveUserEmail } from '../../shared/impersonation';
|
||||
import {
|
||||
approvalListTitle,
|
||||
approvalListTitleForListId,
|
||||
@@ -146,6 +147,14 @@ const DismissalView: React.FC<IDismissalViewProps> = ({ context, itemId, formKey
|
||||
// сейчас активный шаг: getManagerEmail дублирует тот же запрос
|
||||
// (Employee/Manager, managerType=chief), что approval-route делает для
|
||||
// HeadType.Chief при планировании этого же маршрута (см. README формы).
|
||||
//
|
||||
// Сравниваем с effectiveUserEmail, а не с context.pageContext.user.email
|
||||
// напрямую: getPendingRowForCurrentUser (через ApprovalListService.
|
||||
// getCurrentUserId) уже учитывает отладочную подмену личности (см.
|
||||
// shared/impersonation.ts) — без того же самого здесь «активный шаг есть»
|
||||
// (active=true под подменённым) и «это я» (isManager=false, сравнили с
|
||||
// РЕАЛЬНЫМ логином) расходились бы, и поле оставалось бы заблокированным
|
||||
// даже когда подмена указывает именно на этого руководителя.
|
||||
useEffect(() => {
|
||||
if (!data.Employee) return;
|
||||
let alive = true;
|
||||
@@ -153,8 +162,7 @@ const DismissalView: React.FC<IDismissalViewProps> = ({ context, itemId, formKey
|
||||
.then(([pending, managerEmail]) => {
|
||||
if (!alive) return;
|
||||
const active = !!pending && !pending.isDelegator;
|
||||
const isManager =
|
||||
!!managerEmail && managerEmail.toLowerCase() === context.pageContext.user.email.toLowerCase();
|
||||
const isManager = !!managerEmail && managerEmail.toLowerCase() === effectiveUserEmail(context).toLowerCase();
|
||||
setAssetsAcceptorEditable(active && isManager);
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
Reference in New Issue
Block a user