Skip to content

Commit a8b7039

Browse files
authored
Merge pull request #4351 from Jr7468/RuleOffcanvasFix
Fixed Mailbox Rule offCanvas erroring when attempting to open
2 parents 8454d08 + 8e8bc93 commit a8b7039

File tree

1 file changed

+68
-19
lines changed

1 file changed

+68
-19
lines changed

src/pages/identity/administration/users/user/exchange.jsx

Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -669,13 +669,15 @@ const Page = () => {
669669
type: "POST",
670670
icon: <PlayArrow />,
671671
url: "/api/ExecSetMailboxRule",
672-
data: {
673-
ruleId: "Identity",
674-
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
675-
ruleName: "Name",
676-
Enable: true,
672+
customDataformatter: (row, action, formData) => {
673+
return {
674+
ruleId: row?.Identity,
675+
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
676+
ruleName: row?.Name,
677+
Enable: true,
678+
};
677679
},
678-
condition: (row) => !row.Enabled,
680+
condition: (row) => row && !row.Enabled,
679681
confirmText: "Are you sure you want to enable this mailbox rule?",
680682
multiPost: false,
681683
},
@@ -684,13 +686,15 @@ const Page = () => {
684686
type: "POST",
685687
icon: <Block />,
686688
url: "/api/ExecSetMailboxRule",
687-
data: {
688-
ruleId: "Identity",
689-
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
690-
ruleName: "Name",
691-
Disable: true,
689+
customDataformatter: (row, action, formData) => {
690+
return {
691+
ruleId: row?.Identity,
692+
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
693+
ruleName: row?.Name,
694+
Disable: true,
695+
};
692696
},
693-
condition: (row) => row.Enabled,
697+
condition: (row) => row && row.Enabled,
694698
confirmText: "Are you sure you want to disable this mailbox rule?",
695699
multiPost: false,
696700
},
@@ -699,10 +703,12 @@ const Page = () => {
699703
type: "POST",
700704
icon: <Delete />,
701705
url: "/api/ExecRemoveMailboxRule",
702-
data: {
703-
ruleId: "Identity",
704-
ruleName: "Name",
705-
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
706+
customDataformatter: (row, action, formData) => {
707+
return {
708+
ruleId: row?.Identity,
709+
ruleName: row?.Name,
710+
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
711+
};
706712
},
707713
confirmText: "Are you sure you want to remove this mailbox rule?",
708714
multiPost: false,
@@ -754,7 +760,50 @@ const Page = () => {
754760
cardSx={{ p: 0, m: -2 }}
755761
title="Rule Details"
756762
propertyItems={properties}
757-
actionItems={mailboxRuleActions}
763+
actionItems={[
764+
{
765+
label: "Enable Mailbox Rule",
766+
type: "POST",
767+
icon: <PlayArrow />,
768+
url: "/api/ExecSetMailboxRule",
769+
data: {
770+
ruleId: data?.Identity,
771+
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
772+
ruleName: data?.Name,
773+
Enable: true,
774+
},
775+
confirmText: "Are you sure you want to enable this mailbox rule?",
776+
multiPost: false,
777+
},
778+
{
779+
label: "Disable Mailbox Rule",
780+
type: "POST",
781+
icon: <Block />,
782+
url: "/api/ExecSetMailboxRule",
783+
data: {
784+
ruleId: data?.Identity,
785+
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
786+
ruleName: data?.Name,
787+
Disable: true,
788+
},
789+
confirmText: "Are you sure you want to disable this mailbox rule?",
790+
multiPost: false,
791+
},
792+
{
793+
label: "Remove Mailbox Rule",
794+
type: "POST",
795+
icon: <Delete />,
796+
url: "/api/ExecRemoveMailboxRule",
797+
data: {
798+
ruleId: data?.Identity,
799+
ruleName: data?.Name,
800+
userPrincipalName: graphUserRequest.data?.[0]?.userPrincipalName,
801+
},
802+
confirmText: "Are you sure you want to remove this mailbox rule?",
803+
multiPost: false,
804+
relatedQueryKeys: `MailboxRules-${userId}`,
805+
},
806+
]}
758807
/>
759808
);
760809
},
@@ -777,7 +826,7 @@ const Page = () => {
777826
confirmText: "Are you sure you want to make this the primary proxy address?",
778827
multiPost: false,
779828
relatedQueryKeys: `ListUsers-${userId}`,
780-
condition: (row) => !row.Type === "Primary",
829+
condition: (row) => row && row.Type !== "Primary",
781830
},
782831
{
783832
label: "Remove Proxy Address",
@@ -792,7 +841,7 @@ const Page = () => {
792841
confirmText: "Are you sure you want to remove this proxy address?",
793842
multiPost: false,
794843
relatedQueryKeys: `ListUsers-${userId}`,
795-
condition: (row) => !row.Type === "Primary",
844+
condition: (row) => row && row.Type !== "Primary",
796845
},
797846
];
798847

0 commit comments

Comments
 (0)