Disable the validation badge for those who do not want it (#5994)

* disabled on string values: "127.0.0.1", "localhost", "none"
This commit is contained in:
Wesley Schwengle
2020-06-10 18:31:35 -04:00
committed by GitHub
parent 21f51494a2
commit 117dcc9b16
4 changed files with 60 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ import React from "react"
import URL from "url-parse"
import PropTypes from "prop-types"
import { sanitizeUrl } from "core/utils"
import { sanitizeUrl, requiresValidationURL } from "core/utils"
import win from "core/window"
export default class OnlineValidatorBadge extends React.Component {
@@ -48,8 +48,8 @@ export default class OnlineValidatorBadge extends React.Component {
if ( typeof spec === "object" && Object.keys(spec).length) return null
if (!this.state.url || !this.state.validatorUrl || this.state.url.indexOf("localhost") >= 0
|| this.state.url.indexOf("127.0.0.1") >= 0) {
if (!this.state.url || !requiresValidationURL(this.state.validatorUrl)
|| !requiresValidationURL(this.state.url)) {
return null
}