Themes: Ensure the theme slug is set before checking if the theme is installed or active.

This fixes an issue with every installed theme being marked as active on Themes screen.

The slug is set on Add Themes screen, but not on Themes.

Follow-up to [47924].

Props BackuPs, mukesh27, SergeyBiryukov.
Fixes #50381. See #50334.
Built from https://develop.svn.wordpress.org/trunk@48037


git-svn-id: http://core.svn.wordpress.org/trunk@47804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-06-13 14:26:07 +00:00
parent c7b843302f
commit 04200b39ce
3 changed files with 11 additions and 9 deletions

View File

@ -28,14 +28,16 @@ themes.Model = Backbone.Model.extend({
initialize: function() {
var description;
// If the theme is already installed, set an attribute.
if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) {
this.set({ installed: true });
}
if ( this.get( 'slug' ) ) {
// If the theme is already installed, set an attribute.
if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) {
this.set({ installed: true });
}
// If the theme is active, set an attribute.
if ( themes.data.activeTheme === this.get( 'slug' ) ) {
this.set({ active: true });
// If the theme is active, set an attribute.
if ( themes.data.activeTheme === this.get( 'slug' ) ) {
this.set({ active: true });
}
}
// Set the attributes.

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48036';
$wp_version = '5.5-alpha-48037';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.