Use proper prefix for user_failed_login activity (#32092)
For #31343 Fixed the message rendered from user_failed_login global activities on the Activity feed if the email is not specified.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
* Fixed the message rendered from user_failed_login global activities on the Activity feed if the email is not specified.
|
||||
+15
-1
@@ -276,7 +276,21 @@ describe("Activity Feed", () => {
|
||||
})
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("foo@example.com", { exact: false })
|
||||
screen.getByText("foo@example.com", {
|
||||
exact: false,
|
||||
})
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders a user_failed_login without an email", () => {
|
||||
const activity = createMockActivity({
|
||||
type: ActivityType.UserFailedLogin,
|
||||
details: { email: "", public_ip: "192.168.0.1" },
|
||||
});
|
||||
render(<GlobalActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
expect(
|
||||
screen.getByText("Somebody failed", { exact: false })
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
+11
-2
@@ -173,10 +173,19 @@ const TAGGED_TEMPLATES = {
|
||||
);
|
||||
},
|
||||
userFailedLogin: (activity: IActivity) => {
|
||||
const { email, public_ip } = activity.details || {};
|
||||
|
||||
const actor = email ? (
|
||||
<>
|
||||
Somebody using <b>{email}</b>
|
||||
</>
|
||||
) : (
|
||||
<>Somebody</>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
Somebody using <b>{activity.details?.email}</b> failed to log in from
|
||||
public IP {activity.details?.public_ip}.
|
||||
{actor} failed to log in from public IP {public_ip}.
|
||||
</>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user