Skip to content

Commit

Permalink
Site Level User Profile: clean up feature flags (take 2) (#94326)
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar authored Sep 10, 2024
1 parent 9421126 commit 8f6159f
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 84 deletions.
5 changes: 1 addition & 4 deletions client/layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,7 @@ class Layout extends Component {
) }
<QueryPreferences />
<QuerySiteFeatures siteIds={ [ this.props.siteId ] } />
{ ( this.props.isUnifiedSiteSidebarVisible ||
config.isEnabled( 'layout/site-level-user-profile' ) ) && (
<QuerySiteAdminColor siteId={ this.props.siteId } />
) }
<QuerySiteAdminColor siteId={ this.props.siteId } />
{ config.isEnabled( 'layout/query-selected-editor' ) && (
<QuerySiteSelectedEditor siteId={ this.props.siteId } />
) }
Expand Down
8 changes: 2 additions & 6 deletions client/layout/masterbar/logged-in.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,8 @@ class MasterbarLoggedIn extends Component {
}

renderProfileMenu() {
const { translate, user, siteUrl, isClassicView } = this.props;
const editProfileLink =
siteUrl && ( config.isEnabled( 'layout/site-level-user-profile' ) || isClassicView )
? siteUrl + '/wp-admin/profile.php'
: '/me';

const { translate, user, siteAdminUrl } = this.props;
const editProfileLink = siteAdminUrl ? `${ siteAdminUrl }profile.php` : '/me';
const profileActions = [
{
label: (
Expand Down
4 changes: 2 additions & 2 deletions client/layout/masterbar/test/logged-in.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { screen } from '@testing-library/react';
import React from 'react';
import commandPaletteReducer from 'calypso/state/command-palette/reducers';
import preferencesReducer from 'calypso/state/preferences/reducer';
import { getSiteUrl } from 'calypso/state/sites/selectors';
import { getSiteAdminUrl } from 'calypso/state/sites/selectors';
import uiReducer from 'calypso/state/ui/reducer';
import { renderWithProvider } from 'calypso/test-helpers/testing-library';
import MasterbarLoggedIn from '../logged-in';
Expand Down Expand Up @@ -42,7 +42,7 @@ test( 'edit profile menu link goes to /me when the user has no site', () => {
} );

test( 'edit profile menu link goes to site.com/wp-admin/profile.php when the user has a site', () => {
getSiteUrl.mockReturnValue( 'example.com' );
getSiteAdminUrl.mockReturnValue( 'example.com/wp-admin/' );

renderWithState( <MasterbarLoggedIn /> );

Expand Down
51 changes: 10 additions & 41 deletions client/me/account/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Component } from 'react';
import { connect } from 'react-redux';
import CSSTransition from 'react-transition-group/CSSTransition';
import TransitionGroup from 'react-transition-group/TransitionGroup';
import ColorSchemePicker from 'calypso/blocks/color-scheme-picker';
import QueryUserSettings from 'calypso/components/data/query-user-settings';
import FormButton from 'calypso/components/forms/form-button';
import FormButtonsBar from 'calypso/components/forms/form-buttons-bar';
Expand All @@ -30,7 +29,6 @@ import SectionHeader from 'calypso/components/section-header';
import SitesDropdown from 'calypso/components/sites-dropdown';
import { withGeoLocation } from 'calypso/data/geo/with-geolocation';
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker';
import { supportsCssCustomProperties } from 'calypso/lib/feature-detection';
import { ENABLE_TRANSLATOR_KEY } from 'calypso/lib/i18n-utils/constants';
import { onboardingUrl } from 'calypso/lib/paths';
import { protectForm } from 'calypso/lib/protect-form';
Expand Down Expand Up @@ -677,24 +675,6 @@ class Account extends Component {
{ this.renderPrimarySite() }
</FormFieldset>

{ ! config.isEnabled( 'layout/site-level-user-profile' ) && (
<FormFieldset>
<FormLabel htmlFor="user_URL">{ translate( 'Web address' ) }</FormLabel>
<FormTextInput
disabled={ this.getDisabledState( ACCOUNT_FORM_NAME ) }
id="user_URL"
name="user_URL"
type="url"
onFocus={ this.getFocusHandler( 'Web Address Field' ) }
value={ this.getUserSetting( 'user_URL' ) || '' }
onChange={ this.updateUserSettingInput }
/>
<FormSettingExplanation>
{ translate( 'Shown publicly when you comment on blogs.' ) }
</FormSettingExplanation>
</FormFieldset>
) }

<FormButton
isSubmitting={ this.isSubmittingForm( ACCOUNT_FORM_NAME ) }
disabled={ this.shouldDisableAccountSubmitButton() }
Expand Down Expand Up @@ -962,27 +942,16 @@ class Account extends Component {
<ToggleSitesAsLandingPage />
</FormFieldset>

{ config.isEnabled( 'me/account/color-scheme-picker' ) &&
supportsCssCustomProperties() && (
<FormFieldset>
<FormLabel id="account__color_scheme" htmlFor="color_scheme">
{ translate( 'Dashboard color scheme' ) }
</FormLabel>
{ config.isEnabled( 'layout/site-level-user-profile' ) ? (
<FormSettingExplanation>
{ translate(
'You can now set the color scheme on your individual site by visiting Users → Profile from your site dashboard.'
) }
</FormSettingExplanation>
) : (
<ColorSchemePicker
disabled={ this.getDisabledState( INTERFACE_FORM_NAME ) }
defaultSelection="classic-dark"
onSelection={ this.updateColorScheme }
/>
) }
</FormFieldset>
) }
<FormFieldset>
<FormLabel id="account__color_scheme" htmlFor="color_scheme">
{ translate( 'Dashboard color scheme' ) }
</FormLabel>
<FormSettingExplanation>
{ translate(
'You can now set the color scheme on your individual site by visiting Users → Profile from your site dashboard.'
) }
</FormSettingExplanation>
</FormFieldset>
</form>
</Card>

Expand Down
47 changes: 21 additions & 26 deletions client/me/profile/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isEnabled } from '@automattic/calypso-config';
import { Card, FormLabel } from '@automattic/components';
import { localize } from 'i18n-calypso';
import { flowRight as compose } from 'lodash';
Expand Down Expand Up @@ -101,33 +100,29 @@ class Profile extends Component {
onFocus={ this.getFocusHandler( 'Display Name Field' ) }
value={ this.props.getSetting( 'display_name' ) }
/>
{ isEnabled( 'layout/site-level-user-profile' ) && (
<FormSettingExplanation>
{ this.props.translate( 'Shown publicly when you comment on blogs.' ) }
</FormSettingExplanation>
) }
<FormSettingExplanation>
{ this.props.translate( 'Shown publicly when you comment on blogs.' ) }
</FormSettingExplanation>
</FormFieldset>

{ isEnabled( 'layout/site-level-user-profile' ) && (
<FormFieldset>
<FormLabel htmlFor="user_URL">
{ this.props.translate( 'Public web address' ) }
</FormLabel>
<FormTextInput
disabled={ this.props.getDisabledState() }
id="user_URL"
name="user_URL"
type="url"
onChange={ this.props.updateSetting }
onFocus={ this.getFocusHandler( 'Web Address Field' ) }
placeholder="https://example.com"
value={ this.props.getSetting( 'user_URL' ) }
/>
<FormSettingExplanation>
{ this.props.translate( 'Shown publicly when you comment on blogs.' ) }
</FormSettingExplanation>
</FormFieldset>
) }
<FormFieldset>
<FormLabel htmlFor="user_URL">
{ this.props.translate( 'Public web address' ) }
</FormLabel>
<FormTextInput
disabled={ this.props.getDisabledState() }
id="user_URL"
name="user_URL"
type="url"
onChange={ this.props.updateSetting }
onFocus={ this.getFocusHandler( 'Web Address Field' ) }
placeholder="https://example.com"
value={ this.props.getSetting( 'user_URL' ) }
/>
<FormSettingExplanation>
{ this.props.translate( 'Shown publicly when you comment on blogs.' ) }
</FormSettingExplanation>
</FormFieldset>

<FormFieldset>
<FormLabel htmlFor="description">{ this.props.translate( 'About me' ) }</FormLabel>
Expand Down
1 change: 0 additions & 1 deletion config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"layout/app-banner": true,
"layout/guided-tours": true,
"layout/query-selected-editor": true,
"layout/site-level-user-profile": true,
"layout/support-article-dialog": true,
"legal-updates-banner": true,
"livechat_solution": true,
Expand Down
1 change: 0 additions & 1 deletion config/horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"layout/app-banner": true,
"layout/guided-tours": true,
"layout/query-selected-editor": true,
"layout/site-level-user-profile": true,
"layout/support-article-dialog": true,
"legal-updates-banner": false,
"livechat_solution": true,
Expand Down
1 change: 0 additions & 1 deletion config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"layout/app-banner": true,
"layout/guided-tours": true,
"layout/query-selected-editor": true,
"layout/site-level-user-profile": true,
"layout/support-article-dialog": true,
"legal-updates-banner": false,
"livechat_solution": true,
Expand Down
1 change: 0 additions & 1 deletion config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
"layout/app-banner": true,
"layout/guided-tours": true,
"layout/query-selected-editor": true,
"layout/site-level-user-profile": true,
"layout/support-article-dialog": true,
"legal-updates-banner": false,
"livechat_solution": true,
Expand Down
1 change: 0 additions & 1 deletion config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"layout/app-banner": true,
"layout/guided-tours": true,
"layout/query-selected-editor": true,
"layout/site-level-user-profile": true,
"layout/support-article-dialog": true,
"legal-updates-banner": false,
"livechat_solution": true,
Expand Down

0 comments on commit 8f6159f

Please sign in to comment.