Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: hide username from profile page" #1001

Closed
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: 1 addition & 7 deletions src/profile/ProfilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import UsernameDescription from './UsernameDescription';
import PageLoading from './PageLoading';
import Banner from './Banner';
import LearningGoal from './forms/LearningGoal';
import { getFirstAndLastNameInitial } from './utils';

// Selectors
import { profilePageSelector } from './data/selectors';
Expand Down Expand Up @@ -125,12 +124,9 @@ class ProfilePage extends React.Component {
renderHeadingLockup() {
const { dateJoined } = this.props;

const autoGeneratedUsernameEnabled = !!this.props.autoGeneratedUsernameEnabled;
return (
<span data-hj-suppress>
<h1 className="h2 mb-0 font-weight-bold text-truncate">
{!autoGeneratedUsernameEnabled ? this.props.params.username : getFirstAndLastNameInitial(this.props.name)}
</h1>
<h1 className="h2 mb-0 font-weight-bold text-truncate">{this.props.params.username}</h1>
<DateJoined date={dateJoined} />
{this.isYOBDisabled() && <UsernameDescription />}
<hr className="d-none d-md-block" />
Expand Down Expand Up @@ -335,7 +331,6 @@ ProfilePage.propTypes = {
// Account data
requiresParentalConsent: PropTypes.bool,
dateJoined: PropTypes.string,
autoGeneratedUsernameEnabled: PropTypes.bool,

// Bio form data
bio: PropTypes.string,
Expand Down Expand Up @@ -428,7 +423,6 @@ ProfilePage.defaultProps = {
courseCertificates: null,
requiresParentalConsent: null,
dateJoined: null,
autoGeneratedUsernameEnabled: false,
};

export default connect(
Expand Down
21 changes: 0 additions & 21 deletions src/profile/ProfilePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,6 @@ describe('<ProfilePage />', () => {
expect(tree).toMatchSnapshot();
});

it('renders the component without the username field and displays the full name when hide_username is true', () => {
const storeData = JSON.parse(JSON.stringify(storeMocks.viewOwnProfile));
storeData.profilePage.account.autoGeneratedUsernameEnabled = true;
storeData.profilePage.account.name = 'Test User';

const contextValue = {
authenticatedUser: { userId: 123, username: 'staff', administrator: true },
config: getConfig(),
};

const component = (
<ProfilePageWrapper
contextValue={contextValue}
store={mockStore(storeData)}
/>
);

const { container: tree } = render(component);
expect(tree).toMatchSnapshot();
});

it('viewing other profile with all fields', () => {
const contextValue = {
authenticatedUser: { userId: 123, username: 'staff', administrator: true },
Expand Down
Loading
Loading