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
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { userPreferenceOptimisticMutation, userPreferenceQuery } from '@automattic/api-queries';
import { useMutation, useSuspenseQuery } from '@tanstack/react-query';
import { Link } from '@tanstack/react-router';
import { ToggleControl } from '@wordpress/components';
import { useDispatch } from '@wordpress/data';
import { createInterpolateElement } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import { store as noticesStore } from '@wordpress/notices';
import { useAnalytics } from '../../../app/analytics';
Expand Down Expand Up @@ -45,6 +47,15 @@ export const AchievementsCard = () => {
} );
};

const helpText = createInterpolateElement(
__(
'Receive notifications when you unlock new achievements. This setting overrides <link>site-level settings</link>.'
),
{
link: <Link to="/me/notifications/sites" />,
}
);

return (
<Card>
<CardBody>
Expand All @@ -53,9 +64,7 @@ export const AchievementsCard = () => {
checked={ notifications !== 'disabled' }
disabled={ isPending }
label={ __( 'Achievements' ) }
help={ __(
'Receive notifications when you unlock new achievements. This setting overrides site-level settings.'
) }
help={ helpText }
onChange={ handleChange }
/>
</CardBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,9 @@ describe( 'NotificationsExtras', () => {
expect( screen.getByText( 'Reminders about your posts from past years.' ) ).toBeVisible();
expect( screen.getByLabelText( 'Achievements' ) ).toBeVisible();
expect(
screen.getByText(
'Receive notifications when you unlock new achievements. This setting overrides site-level settings.'
)
screen.getByText( /Receive notifications when you unlock new achievements\./ )
).toBeVisible();
expect( screen.getByRole( 'link', { name: 'site-level settings' } ) ).toBeVisible();
} );

it( 'saves the On this day setting when toggled', async () => {
Expand Down
Loading