Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog/7314.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copy this file and rename it (e.g., pr-number.yaml or feature-name.yaml)
# Fill in the required fields and delete this comment block

type: Added # One of: Added, Changed, Developer Experience, Deprecated, Docs, Fixed, Removed, Security
description: More descriptive error message for unauthorized actions in action center
pr: 7314 # PR number
labels: [] # Optional: ["high-risk", "db-migration"]

Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,18 @@ export const useBulkActions = (
});

if (isErrorResult(mutationResult)) {
/** Our error messages are bad. Purposefully out of place * */
Comment thread
speaker-ender marked this conversation as resolved.
const errorReason =
"error" in mutationResult &&
"status" in mutationResult.error &&
mutationResult.error.status === 403
? "insufficient permissions to perform action"
: "";

messageApi.open({
key,
type: "error",
content: getActionErrorMessage(actionType),
content: getActionErrorMessage(errorReason),
duration: 5,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,18 @@ export const useFieldActions = (
const result = await mutationFn(urns, field);

if (isErrorResult(result)) {
/** Our error messages are bad. * */
Comment thread
speaker-ender marked this conversation as resolved.
const errorReason =
"error" in result &&
"status" in result.error &&
result.error.status === 403
? "insufficient permissions to perform action"
: "";

messageApi.open({
key,
type: "error",
content: getActionErrorMessage(actionType),
content: getActionErrorMessage(errorReason),
duration: 5,
});
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@ export const getActionSuccessMessage = (
) =>
`${FIELD_ACTION_COMPLETED[actionType]}${pluralize(itemCount ?? 0, "", `${actionType === FieldActionType.ASSIGN_CATEGORIES ? " for" : ""} ${itemCount?.toLocaleString()} resources`)}`;

export const getActionErrorMessage = (actionType: FieldActionType) => {
const activityTabSuffix =
actionType === FieldActionType.CLASSIFY ||
actionType === FieldActionType.PROMOTE
? ": View summary in the activity tab"
: "";
return `Action failed${activityTabSuffix}`;
};
export const getActionErrorMessage = (reason?: string) =>
[`Action failed`, ...(reason ? [reason] : [])].join(": ");
Comment thread
speaker-ender marked this conversation as resolved.

const CONFIDENCE_BUCKET_TO_SEVERITY: Record<
ConfidenceBucket,
Expand Down
Loading