forked from baron/baron-sso
recent changes 관계 상세 파싱 수정
This commit is contained in:
@@ -89,6 +89,16 @@ describe("recent client changes", () => {
|
||||
{ label: "Relation", value: "admins" },
|
||||
{ label: "Subject", value: "User:1" },
|
||||
]);
|
||||
|
||||
expect(
|
||||
buildRecentClientChangeDetails("ADD_RELATION", {
|
||||
relation: "config_editor",
|
||||
subject: "User:2",
|
||||
}),
|
||||
).toEqual([
|
||||
{ label: "Relation", value: "config_editor" },
|
||||
{ label: "Subject", value: "User:2" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("ignores audit object key order changes in update details", () => {
|
||||
|
||||
@@ -257,6 +257,12 @@ export function buildRecentClientChangeDetails(
|
||||
) {
|
||||
const before = isRecord(details.before) ? details.before : {};
|
||||
const after = isRecord(details.after) ? details.after : {};
|
||||
const sourceDetails =
|
||||
action === "ADD_RELATION"
|
||||
? { ...after, ...details }
|
||||
: action === "REMOVE_RELATION"
|
||||
? { ...before, ...details }
|
||||
: {};
|
||||
|
||||
if (action === "ROTATE_SECRET") {
|
||||
return [
|
||||
@@ -268,7 +274,7 @@ export function buildRecentClientChangeDetails(
|
||||
}
|
||||
|
||||
if (action === "ADD_RELATION" || action === "REMOVE_RELATION") {
|
||||
const source = action === "ADD_RELATION" ? after : before;
|
||||
const source = sourceDetails;
|
||||
return [
|
||||
...(source.relation
|
||||
? [
|
||||
|
||||
Reference in New Issue
Block a user