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

Mobile Theme: remove feature #14714

Merged
merged 9 commits into from
Feb 18, 2020
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
1 change: 0 additions & 1 deletion _inc/client/components/navigation-settings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export const NavigationSettings = createReactClass( {
'custom-content-types',
'post-by-email',
'infinite-scroll',
'minileven',
'copy-post',
] ) && (
<NavItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe( 'NavigationSettings', () => {
siteAdminUrl: 'https://example.org/wp-admin/',
searchForTerm: () => {},
isLinked: true,
moduleList: { minileven: true, sitemaps: true, carousel: true, 'custom-content-types': true, 'verification-tools': true, markdown: true, 'infinite-scroll': true, 'gravatar-hovercards': true, sharedaddy: true, sso: true, 'related-posts': true, monitor: true, vaultpress: true, stats: true, masterbar: true, 'google-analytics': true, 'seo-tools': true, wordads: true, videopress: true, subscriptions: true, comments: true, 'post-by-email': true, photon: true, publicize: true, likes: true },
moduleList: { sitemaps: true, carousel: true, 'custom-content-types': true, 'verification-tools': true, markdown: true, 'infinite-scroll': true, 'gravatar-hovercards': true, sharedaddy: true, sso: true, 'related-posts': true, monitor: true, vaultpress: true, stats: true, masterbar: true, 'google-analytics': true, 'seo-tools': true, wordads: true, videopress: true, subscriptions: true, comments: true, 'post-by-email': true, photon: true, publicize: true, likes: true },
isPluginActive: () => true
};

Expand Down
1 change: 0 additions & 1 deletion _inc/client/components/settings-card/test/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe( 'SettingsCard', () => {

const allCardsNonAdminCantAccess = [
'widget-visibility',
'minileven',
'contact-form',
'sitemaps',
'latex',
Expand Down
1 change: 0 additions & 1 deletion _inc/client/components/settings-group/test/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe( 'SettingsGroup', () => {

const allGroupsNonAdminCantAccess = [
'widget-visibility',
'minileven',
'contact-form',
'sitemaps',
'latex',
Expand Down
14 changes: 0 additions & 14 deletions _inc/client/settings/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,3 @@
box-shadow: none;
border: none;
}

/* Mobile Theme Card */
.jp-form-settings-group.minileven {
.jp-form-settings-notice {
margin: 15px 0;
}

&.inactive {
p, .form-toggle__label {
color: $gray;
transition: all 0.75s;
}
}
}
1 change: 0 additions & 1 deletion _inc/client/writing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export class Writing extends React.Component {
'custom-content-types',
'post-by-email',
'infinite-scroll',
'minileven',
'widgets',
'widget-visibility',
].some( this.props.isModuleFound );
Expand Down
127 changes: 4 additions & 123 deletions _inc/client/writing/theme-enhancements.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@
* External dependencies
*/
import React from 'react';
import classNames from 'classnames';
import { connect } from 'react-redux';
import { translate as __ } from 'i18n-calypso';
import CompactFormToggle from 'components/form/form-toggle/compact';
import analytics from 'lib/analytics';

/**
* Internal dependencies
*/
import { FormFieldset, FormLabel, FormLegend } from 'components/forms';
import { FormLabel, FormLegend } from 'components/forms';
import { ModuleToggle } from 'components/module-toggle';
import { getModule } from 'state/modules';
import { currentThemeSupports } from 'state/initial-state';
import { isModuleFound } from 'state/search';
import { withModuleSettingsFormHelpers } from 'components/module-settings/with-module-settings-form-helpers';
import SettingsCard from 'components/settings-card';
import SettingsGroup from 'components/settings-group';
import SimpleNotice from 'components/notice';
import ModuleOverriddenBanner from 'components/module-overridden-banner';

class ThemeEnhancements extends React.Component {
Expand Down Expand Up @@ -96,51 +93,27 @@ class ThemeEnhancements extends React.Component {
* Get options for initial state.
*
* @returns {Object} {{
* infinite_scroll: *,
* wp_mobile_excerpt: *,
* wp_mobile_featured_images: *,
* wp_mobile_app_promos: *
* infinite_scroll: *
* }}
*/
state = {
infinite_mode: this.getInfiniteMode(),
wp_mobile_excerpt: this.props.getOptionValue( 'wp_mobile_excerpt', 'minileven' ),
wp_mobile_featured_images: this.props.getOptionValue(
'wp_mobile_featured_images',
'minileven'
),
wp_mobile_app_promos: this.props.getOptionValue( 'wp_mobile_app_promos', 'minileven' ),
};

handleInfiniteScrollModeChange = key => {
return () => this.updateInfiniteMode( key );
};

handleMinilevenOptionChange = ( optionName, module ) => {
return () => this.updateOptions( optionName, module );
};

trackMinilevenLearnMore = () => {
analytics.tracks.recordJetpackClick( {
target: 'learn-more',
feature: 'minileven',
extra: 'deprecated-link',
} );
};

render() {
const foundInfiniteScroll = this.props.isModuleFound( 'infinite-scroll' ),
foundCustomCSS = this.props.isModuleFound( 'custom-css' ),
foundMinileven = this.props.isModuleFound( 'minileven' );
foundCustomCSS = this.props.isModuleFound( 'custom-css' );

if ( ! foundInfiniteScroll && ! foundMinileven && ! foundCustomCSS ) {
if ( ! foundInfiniteScroll && ! foundCustomCSS ) {
return null;
}

const infScr = this.props.getModule( 'infinite-scroll' );
const minileven = this.props.getModule( 'minileven' );
const customCSS = this.props.getModule( 'custom-css' );
const isMinilevenActive = this.props.getOptionValue( minileven.module );

const infiniteScrollDisabledByOverride =
'inactive' === this.props.getModuleOverride( 'infinite-scroll' );
Expand Down Expand Up @@ -215,98 +188,6 @@ class ThemeEnhancements extends React.Component {
) }
</SettingsGroup>
) }
{ foundMinileven && (
<SettingsGroup
hasChild
module={ { module: minileven.module } }
key={ `theme_enhancement_${ minileven.module }` }
support={ {
text: __(
'Enables a lightweight, mobile-friendly theme ' +
'that will be displayed to visitors on mobile devices.'
),
link: 'https://jetpack.com/support/mobile-theme',
} }
className={ classNames(
'minileven',
`${ isMinilevenActive ? `active` : `inactive` }`
) }
>
<FormLegend className="jp-form-label-wide">{ __( 'Mobile Theme' ) }</FormLegend>
<SimpleNotice
showDismiss={ false }
status="is-info"
className="jp-form-settings-notice"
>
{ __(
'{{b}}Note:{{/b}} This feature is being retired ' +
'and will be removed from Jetpack in March. ' +
'{{link}}Learn more{{/link}}',
{
components: {
b: <strong />,
link: (
<a
href="https://jetpack.com/support/mobile-theme/"
target="_blank"
rel="noopener noreferrer"
onClick={ this.trackMinilevenLearnMore }
/>
),
},
context: 'Link leads to a support document.',
}
) }
</SimpleNotice>
<p>
{ __(
'Give your site a fast-loading, streamlined look for mobile devices. Visitors will ' +
'still see your regular theme on other screen sizes.'
) }
</p>
<ModuleToggle
slug={ minileven.module }
activated={ isMinilevenActive }
toggling={ this.props.isSavingAnyOption( minileven.module ) }
toggleModule={ this.props.toggleModuleNow }
disabled={ ! isMinilevenActive }
>
<span className="jp-form-toggle-explanation">{ minileven.description }</span>
</ModuleToggle>
<FormFieldset>
{ [
{
key: 'wp_mobile_excerpt',
label: __(
'Show excerpts instead of full posts on front page and archive pages'
),
},
{
key: 'wp_mobile_featured_images',
label: __( 'Show featured images' ),
},
{
key: 'wp_mobile_app_promos',
label: __(
'Show an ad for the WordPress mobile apps in the footer of the mobile theme'
),
},
].map( chkbx => (
<CompactFormToggle
checked={ this.state[ chkbx.key ] }
disabled={
! isMinilevenActive ||
this.props.isSavingAnyOption( [ minileven.module, chkbx.key ] )
}
onChange={ this.handleMinilevenOptionChange( chkbx.key, minileven.module ) }
key={ `${ minileven.module }_${ chkbx.key }` }
>
<span className="jp-form-toggle-explanation">{ chkbx.label }</span>
</CompactFormToggle>
) ) }
</FormFieldset>
</SettingsGroup>
) }
{ foundCustomCSS && (
<SettingsGroup
module={ { module: customCSS.module } }
Expand Down
23 changes: 0 additions & 23 deletions _inc/lib/class.core-rest-api-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -1873,29 +1873,6 @@ public static function get_updateable_data_list( $selector = '' ) {
'jp_group' => 'markdown',
),

// Mobile Theme
'wp_mobile_excerpt' => array(
'description' => esc_html__( 'Excerpts', 'jetpack' ),
'type' => 'boolean',
'default' => 0,
'validate_callback' => __CLASS__ . '::validate_boolean',
'jp_group' => 'minileven',
),
'wp_mobile_featured_images' => array(
'description' => esc_html__( 'Featured Images', 'jetpack' ),
'type' => 'boolean',
'default' => 0,
'validate_callback' => __CLASS__ . '::validate_boolean',
'jp_group' => 'minileven',
),
'wp_mobile_app_promos' => array(
'description' => esc_html__( 'Show a promo for the WordPress mobile apps in the footer of the mobile theme.', 'jetpack' ),
'type' => 'boolean',
'default' => 0,
'validate_callback' => __CLASS__ . '::validate_boolean',
'jp_group' => 'minileven',
),

// Monitor
'monitor_receive_notifications' => array(
'description' => esc_html__( 'Receive Monitor Email Notifications.', 'jetpack' ),
Expand Down
4 changes: 1 addition & 3 deletions class.jetpack-modules-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ function js_templates() {
<# var i = 0;
if ( data.items.length ) {
_.each( data.items, function( item, key, list ) {
if ( item === undefined ) return;
if ( 'minileven' == item.module && ! item.activated ) return;
if ( 'manage' == item.module && item.activated ) return; #>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the opportunity to delete this reference to the Manage module.

if ( item === undefined ) return; #>
<tr class="jetpack-module <# if ( ++i % 2 ) { #> alternate<# } #><# if ( item.activated ) { #> active<# } #><# if ( ! item.available ) { #> unavailable<# } #>" id="{{{ item.module }}}">
<th scope="row" class="check-column">
<# if ( 'videopress' !== item.module ) { #>
Expand Down
34 changes: 31 additions & 3 deletions class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ class Jetpack {
'Fast Secure Contact Form' => 'si-contact-form/si-contact-form.php',
'Ninja Forms' => 'ninja-forms/ninja-forms.php',
),
'minileven' => array(
'WPtouch' => 'wptouch/wptouch.php',
),
'latex' => array(
'LaTeX for WordPress' => 'latex/latex.php',
'Youngwhans Simple Latex' => 'youngwhans-simple-latex/yw-latex.php',
Expand Down Expand Up @@ -438,6 +435,20 @@ function plugin_upgrade() {
update_option( 'wpcom_publish_posts_with_markdown', true );
}

// Minileven deprecation. 8.3.0.
if ( get_option( 'wp_mobile_custom_css' ) ) {
delete_option( 'wp_mobile_custom_css' );
}
if ( Jetpack_Options::get_option( 'wp_mobile_excerpt' ) ) {
Jetpack_Options::delete_option( 'wp_mobile_excerpt' );
}
if ( Jetpack_Options::get_option( 'wp_mobile_featured_images' ) ) {
Jetpack_Options::delete_option( 'wp_mobile_featured_images' );
}
if ( Jetpack_Options::get_option( 'wp_mobile_app_promos' ) ) {
Jetpack_Options::delete_option( 'wp_mobile_app_promos' );
}

if ( did_action( 'wp_loaded' ) ) {
self::upgrade_on_load();
} else {
Expand Down Expand Up @@ -2379,6 +2390,7 @@ function handle_deprecated_modules( $modules ) {
'debug' => null, // Closed out and moved to the debugger library.
'wpcc' => 'sso', // Closed out in 2.6 -- SSO provides the same functionality.
'gplus-authorship' => null, // Closed out in 3.2 -- Google dropped support.
'minileven' => null, // Closed out in 8.3 -- Responsive themes are common now, and so is AMP.
);

// Don't activate SSO if they never completed activating WPCC.
Expand Down Expand Up @@ -6358,6 +6370,22 @@ public function deprecated_hooks() {
// Removed in Jetpack 7.9.0
'jetpack_pwa_manifest' => null,
'jetpack_pwa_background_color' => null,
// Removed in Jetpack 8.3.0.
'jetpack_check_mobile' => null,
'jetpack_mobile_stylesheet' => null,
'jetpack_mobile_template' => null,
'mobile_reject_mobile' => null,
'mobile_force_mobile' => null,
'mobile_app_promo_download' => null,
'mobile_setup' => null,
'jetpack_mobile_footer_before' => null,
'wp_mobile_theme_footer' => null,
'minileven_credits' => null,
'jetpack_mobile_header_before' => null,
'jetpack_mobile_header_after' => null,
'jetpack_mobile_theme_menu' => null,
'minileven_show_featured_images' => null,
'minileven_attachment_size' => null,
);

// This is a silly loop depth. Better way?
Expand Down
Loading