Matthew Hodgson 2018-09-20 01:23:29 +01:00
parent c6fa8ea24c
commit 1aa85c69e4
1 changed files with 10 additions and 2 deletions

View File

@ -217,12 +217,14 @@ module.exports = React.createClass({
let canonical_alias_section; let canonical_alias_section;
if (this.props.canSetCanonicalAlias) { if (this.props.canSetCanonicalAlias) {
let found = false;
canonical_alias_section = ( canonical_alias_section = (
<select onChange={this.onCanonicalAliasChange} value={this.state.canonicalAlias}> <select onChange={this.onCanonicalAliasChange} value={this.state.canonicalAlias}>
<option value="" key="unset">{ _t('not specified') }</option> <option value="" key="unset">{ _t('not specified') }</option>
{ {
Object.keys(self.state.domainToAliases).map(function(domain, i) { Object.keys(self.state.domainToAliases).map((domain, i) => {
return self.state.domainToAliases[domain].map(function(alias, j) { return self.state.domainToAliases[domain].map((alias, j) => {
if (alias === this.state.canonicalAlias) found = true;
return ( return (
<option value={alias} key={i + "_" + j}> <option value={alias} key={i + "_" + j}>
{ alias } { alias }
@ -231,6 +233,12 @@ module.exports = React.createClass({
}); });
}) })
} }
{
found || !this.stateCanonicalAlias ? '' :
<option value={ this.state.canonicalAlias } key='arbitrary'>
{ this.state.canonicalAlias }
</option>
}
</select> </select>
); );
} else { } else {