🐛 Fixed tag metadata fields not being populated when editing in admin (#1714)

closes #12190

The "scratch" concept was being used incorrectly for codeinjection fields and was not initialised with all the required fields.
This commit is contained in:
Fabien 'egg' O'Carroll 2020-09-28 16:20:53 +01:00 committed by GitHub
parent e76439d072
commit 232cafaa8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -316,26 +316,26 @@
<div class="mt6 flex flex-column flex-row-ns flex-wrap items-start justify-between"> <div class="mt6 flex flex-column flex-row-ns flex-wrap items-start justify-between">
<GhFormGroup @class="settings-code" @errors={{this.tag.errors}} @hasValidated={{this.tag.hasValidated}} @property="codeinjectionHead"> <GhFormGroup @class="settings-code" @errors={{this.tag.errors}} @hasValidated={{this.tag.hasValidated}} @property="codeinjectionHead">
<label for="codeinjection-head" class="gh-tag-setting-codeheader">Tag header <code class="fw4 ml1">\{{ghost_head}}</code></label> <label for="codeinjection-head" class="gh-tag-setting-codeheader">Tag header <code class="fw4 ml1">\{{ghost_head}}</code></label>
<GhCmEditor @value={{this.codeinjectionHeadScratch}} <GhCmEditor @value={{this.scratchTag.codeinjectionHead}}
@id="tag-setting-codeinjection-head" @id="tag-setting-codeinjection-head"
@class="gh-tag-setting-codeinjection" @class="gh-tag-setting-codeinjection"
@name="tag-setting-codeinjection-head" @name="tag-setting-codeinjection-head"
@focusOut={{action "setProperty" "codeinjectionHead" this.codeinjectionHeadScratch}} @focusOut={{action "setProperty" "codeinjectionHead" this.scratchTag.codeinjectionHead}}
@stopEnterKeyDownPropagation="true" @stopEnterKeyDownPropagation="true"
@update={{action (mut this.codeinjectionHeadScratch)}} @update={{action (mut this.scratchTag.codeinjectionHead)}}
/> />
<GhErrorMessage @errors={{this.tag.errors}} @property="codeinjectionHead"/> <GhErrorMessage @errors={{this.tag.errors}} @property="codeinjectionHead"/>
</GhFormGroup> </GhFormGroup>
<GhFormGroup @class="settings-code" @errors={{this.tag.errors}} @hasValidated={{this.tag.hasValidated}} @property="codeinjectionFoot"> <GhFormGroup @class="settings-code" @errors={{this.tag.errors}} @hasValidated={{this.tag.hasValidated}} @property="codeinjectionFoot">
<label for="codeinjection-foot"class="gh-tag-setting-codeheader">Tag footer <code class="fw4 ml1">\{{ghost_foot}}</code></label> <label for="codeinjection-foot"class="gh-tag-setting-codeheader">Tag footer <code class="fw4 ml1">\{{ghost_foot}}</code></label>
<GhCmEditor @value={{this.codeinjectionfootScratch}} <GhCmEditor @value={{this.scratchTag.codeinjectionFoot}}
@id="tag-setting-codeinjection-foot" @id="tag-setting-codeinjection-foot"
@class="gh-tag-setting-codeinjection" @class="gh-tag-setting-codeinjection"
@name="tag-setting-codeinjection-foot" @name="tag-setting-codeinjection-foot"
@focusOut={{action "setProperty" "codeinjectionFoot" this.codeinjectionFootScratch}} @focusOut={{action "setProperty" "codeinjectionFoot" this.scratchTag.codeinjectionFoot}}
@stopEnterKeyDownPropagation="true" @stopEnterKeyDownPropagation="true"
@update={{action (mut this.codeinjectionFootScratch)}} @update={{action (mut this.scratchTag.codeinjectionFoot)}}
/> />
<GhErrorMessage @errors={{this.tag.errors}} @property="codeinjectionFoot"/> <GhErrorMessage @errors={{this.tag.errors}} @property="codeinjectionFoot"/>
</GhFormGroup> </GhFormGroup>

View File

@ -7,7 +7,7 @@ import {inject as service} from '@ember/service';
import {slugify} from '@tryghost/string'; import {slugify} from '@tryghost/string';
import {task} from 'ember-concurrency'; import {task} from 'ember-concurrency';
const SCRATCH_PROPS = ['name', 'slug', 'description', 'metaTitle', 'metaDescription']; const SCRATCH_PROPS = ['name', 'slug', 'description', 'metaTitle', 'metaDescription', 'ogTitle', 'ogDescription', 'twitterTitle', 'twitterDescription', 'codeinjectionHead', 'codeinjectionFoot'];
export default Controller.extend({ export default Controller.extend({
notifications: service(), notifications: service(),