Remove fxa to mza notifications (#12784)
* remove yellow banner from user profile edit page * remove fxa to mza datetime req
This commit is contained in:
Родитель
bdc17e73f4
Коммит
08eb2efdec
|
@ -53,7 +53,6 @@ import type {
|
|||
ReactRouterMatchType,
|
||||
} from 'amo/types/router';
|
||||
import { setViewContext } from 'amo/actions/viewContext';
|
||||
import { isMzaBranding } from 'amo/utils/fxa';
|
||||
|
||||
import './styles.scss';
|
||||
|
||||
|
@ -542,35 +541,9 @@ export class UserProfileEditBase extends React.Component<InternalProps, State> {
|
|||
const userProfileURL = `/user/${userId}/`;
|
||||
const overlayClassName = 'UserProfileEdit-deletion-modal';
|
||||
|
||||
const title = isMzaBranding()
|
||||
? i18n.gettext(
|
||||
'Firefox Accounts was renamed to Mozilla accounts on Nov 1',
|
||||
)
|
||||
: i18n.gettext(
|
||||
'Firefox Accounts will be renamed to Mozilla accounts on Nov 1',
|
||||
);
|
||||
|
||||
return (
|
||||
<Page>
|
||||
{alternateOutput || [
|
||||
<div
|
||||
className="UserProfileEdit-notice-wrapper"
|
||||
key="UserProfileEdit-notice-wrapper"
|
||||
>
|
||||
<Notice
|
||||
actionHref="https://support.mozilla.org/kb/firefox-accounts-renamed-mozilla-accounts"
|
||||
actionTarget="_blank"
|
||||
actionText={i18n.gettext('Learn more')}
|
||||
className="UserProfileEdit-fxa-notice"
|
||||
type="warning"
|
||||
>
|
||||
<strong>{title}</strong>
|
||||
<br />
|
||||
{i18n.gettext(`You will still sign in with the same username and
|
||||
password, and there are no other changes to the products that
|
||||
you use.`)}
|
||||
</Notice>
|
||||
</div>,
|
||||
{alternateOutput || (
|
||||
<div className="UserProfileEdit" key="UserProfileEdit">
|
||||
{user && (
|
||||
<Helmet>
|
||||
|
@ -639,11 +612,8 @@ export class UserProfileEditBase extends React.Component<InternalProps, State> {
|
|||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={sanitizeHTML(
|
||||
i18n.sprintf(
|
||||
isMzaBranding()
|
||||
? i18n.gettext(`You can change your email address on
|
||||
Mozilla accounts. %(startLink)sNeed help?%(endLink)s`)
|
||||
: i18n.gettext(`You can change your email address on
|
||||
Firefox Accounts. %(startLink)sNeed help?%(endLink)s`),
|
||||
i18n.gettext(`You can change your email address on
|
||||
Mozilla accounts. %(startLink)sNeed help?%(endLink)s`),
|
||||
{
|
||||
startLink:
|
||||
'<a href="https://support.mozilla.org/kb/change-primary-email-address-firefox-accounts">',
|
||||
|
@ -661,9 +631,7 @@ export class UserProfileEditBase extends React.Component<InternalProps, State> {
|
|||
href={user.fxa_edit_email_url}
|
||||
className="UserProfileEdit-manage-account-link"
|
||||
>
|
||||
{isMzaBranding()
|
||||
? i18n.gettext('Manage Mozilla accounts…')
|
||||
: i18n.gettext('Manage Firefox Accounts…')}
|
||||
{i18n.gettext('Manage Mozilla accounts…')}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
@ -933,8 +901,8 @@ export class UserProfileEditBase extends React.Component<InternalProps, State> {
|
|||
</div>
|
||||
</OverlayCard>
|
||||
)}
|
||||
</div>,
|
||||
]}
|
||||
</div>
|
||||
)}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,14 +2,6 @@
|
|||
|
||||
$font-size-aside: $font-size-xs;
|
||||
|
||||
.UserProfileEdit-notice-wrapper {
|
||||
@include page-padding;
|
||||
|
||||
@include respond-to(large) {
|
||||
margin-bottom: -$padding-page;
|
||||
}
|
||||
}
|
||||
|
||||
.UserProfileEdit {
|
||||
@include page-padding;
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
/* @flow */
|
||||
export const MZA_LAUNCH_DATETIME: Date = new Date(
|
||||
// 2023-11-01 16:00:00 UTC
|
||||
Date.UTC(2023, 10, 1, 16, 0, 0, 0),
|
||||
);
|
||||
export const isMzaBranding = (): boolean => new Date() >= MZA_LAUNCH_DATETIME;
|
|
@ -3,7 +3,6 @@ import { createMemoryHistory } from 'history';
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import { createEvent, fireEvent, waitFor } from '@testing-library/react';
|
||||
|
||||
import * as MzAUtils from 'amo/utils/fxa';
|
||||
import { setViewContext } from 'amo/actions/viewContext';
|
||||
import { createApiError } from 'amo/api/index';
|
||||
import { extractId } from 'amo/pages/UserProfileEdit';
|
||||
|
@ -54,7 +53,6 @@ describe(__filename, () => {
|
|||
const defaultUserId = fakeAuthors[0].id;
|
||||
let history;
|
||||
let store;
|
||||
let isMzaBrandingMock;
|
||||
|
||||
const savedLocation = window.location;
|
||||
|
||||
|
@ -65,14 +63,10 @@ describe(__filename, () => {
|
|||
assign: jest.fn(),
|
||||
});
|
||||
window.scroll = jest.fn();
|
||||
isMzaBrandingMock = jest
|
||||
.spyOn(MzAUtils, 'isMzaBranding')
|
||||
.mockReturnValue(true);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
window.location = savedLocation;
|
||||
isMzaBrandingMock.mockRestore();
|
||||
});
|
||||
|
||||
function defaultUserProps(props = {}) {
|
||||
|
@ -1413,99 +1407,4 @@ describe(__filename, () => {
|
|||
).not.toHaveClass('UserProfileEditPicture-file--has-focus');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Tests for accounts branding', () => {
|
||||
it('renders the Mozilla accounts Branding', () => {
|
||||
isMzaBrandingMock.mockReturnValue(true);
|
||||
renderForCurrentUser();
|
||||
|
||||
expect(
|
||||
screen.getByRole('link', {
|
||||
name: 'Manage Mozilla accounts…',
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTextAcrossTags(
|
||||
'You can change your email address on Mozilla accounts. Need help?',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
|
||||
const bannerElement = screen.getByClassName('UserProfileEdit-fxa-notice');
|
||||
expect(bannerElement).toBeInTheDocument();
|
||||
expect(bannerElement).toHaveTextContent(
|
||||
'Firefox Accounts was renamed to Mozilla accounts on Nov 1',
|
||||
);
|
||||
});
|
||||
|
||||
it('renders the Firefox Accounts Branding', () => {
|
||||
isMzaBrandingMock.mockReturnValue(false);
|
||||
renderForCurrentUser();
|
||||
|
||||
expect(
|
||||
screen.getByRole('link', {
|
||||
name: 'Manage Firefox Accounts…',
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByTextAcrossTags(
|
||||
'You can change your email address on Firefox Accounts. Need help?',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
|
||||
const bannerElement = screen.getByClassName('UserProfileEdit-fxa-notice');
|
||||
expect(bannerElement).toBeInTheDocument();
|
||||
expect(bannerElement).toHaveTextContent(
|
||||
'Firefox Accounts will be renamed to Mozilla accounts on Nov 1',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isMzaBranding datetime switch', () => {
|
||||
let dateMock;
|
||||
|
||||
beforeEach(() => {
|
||||
isMzaBrandingMock.mockRestore();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
dateMock?.mockRestore();
|
||||
});
|
||||
|
||||
it('returns false if the date is earlier than MZA_LAUNCH_DATETIME', () => {
|
||||
const before = new Date();
|
||||
before.setTime(MzAUtils.MZA_LAUNCH_DATETIME.getTime() - 1000);
|
||||
dateMock = jest.spyOn(global, 'Date').mockImplementation(() => before);
|
||||
expect(MzAUtils.isMzaBranding()).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true if the date is earlier than MZA_LAUNCH_DATETIME', () => {
|
||||
const after = new Date();
|
||||
after.setTime(MzAUtils.MZA_LAUNCH_DATETIME.getTime() + 1000);
|
||||
dateMock = jest.spyOn(global, 'Date').mockImplementation(() => after);
|
||||
expect(MzAUtils.isMzaBranding()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fxa banner tests', () => {
|
||||
it('renders the banner on the page', () => {
|
||||
renderForCurrentUser();
|
||||
|
||||
const bannerElement = screen.getByClassName('UserProfileEdit-fxa-notice');
|
||||
expect(bannerElement).toBeInTheDocument();
|
||||
|
||||
expect(bannerElement).toHaveTextContent(
|
||||
'Firefox Accounts was renamed to Mozilla accounts on Nov 1',
|
||||
);
|
||||
expect(bannerElement).toHaveTextContent(
|
||||
'You will still sign in with the same username and password, and there are no other changes to the products that you use.',
|
||||
);
|
||||
|
||||
const infoLink = screen.getByClassName('Notice-button');
|
||||
expect(infoLink).toBeInTheDocument();
|
||||
expect(infoLink).toHaveAttribute(
|
||||
'href',
|
||||
'https://support.mozilla.org/kb/firefox-accounts-renamed-mozilla-accounts',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче