Make WordPress Core


Ignore:
Timestamp:
11/08/2020 09:50:07 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Site Health: Validate the test result data format in JS before using it.

This will discard any invalid responses instead of causing fatal errors.

It also makes badges optional, on the same basis as actions are optional. They are expected, but there may be situations where they are not present.

Props Clorith, dogwithblog, kraftbj, whyisjake, SergeyBiryukov.
Fixes #50145.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/site-health.php

    r47529 r49537  
    145145        <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-{{ data.test }}" type="button">
    146146            <span class="title">{{ data.label }}</span>
    147             <span class="badge {{ data.badge.color }}">{{ data.badge.label }}</span>
     147            <# if ( data.badge ) { #>
     148                <span class="badge {{ data.badge.color }}">{{ data.badge.label }}</span>
     149            <# } #>
    148150            <span class="icon"></span>
    149151        </button>
Note: See TracChangeset for help on using the changeset viewer.