mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
Quick-fix for unnecessary "discard changes" modals
closes #6315 - don't set the `slug` attribute if we get an empty string back from the slug generator to prevent dirty attributes being triggered for `null` getting changed to `''`
This commit is contained in:
parent
3a68b02278
commit
cd9595b3aa
@ -5,7 +5,7 @@ import SlugGenerator from 'ghost/models/slug-generator';
|
|||||||
import boundOneWay from 'ghost/utils/bound-one-way';
|
import boundOneWay from 'ghost/utils/bound-one-way';
|
||||||
import isNumber from 'ghost/utils/isNumber';
|
import isNumber from 'ghost/utils/isNumber';
|
||||||
|
|
||||||
const {$, ArrayProxy, Controller, Handlebars, PromiseProxyMixin, RSVP, computed, guidFor, inject, isArray, observer, run} = Ember;
|
const {$, ArrayProxy, Controller, Handlebars, PromiseProxyMixin, RSVP, computed, guidFor, inject, isArray, isBlank, observer, run} = Ember;
|
||||||
|
|
||||||
export default Controller.extend(SettingsMenuMixin, {
|
export default Controller.extend(SettingsMenuMixin, {
|
||||||
debounceId: null,
|
debounceId: null,
|
||||||
@ -66,7 +66,9 @@ export default Controller.extend(SettingsMenuMixin, {
|
|||||||
|
|
||||||
promise = RSVP.resolve(afterSave).then(() => {
|
promise = RSVP.resolve(afterSave).then(() => {
|
||||||
return this.get('slugGenerator').generateSlug(title).then((slug) => {
|
return this.get('slugGenerator').generateSlug(title).then((slug) => {
|
||||||
|
if (!isBlank(slug)) {
|
||||||
this.set(destination, slug);
|
this.set(destination, slug);
|
||||||
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// Nothing to do (would be nice to log this somewhere though),
|
// Nothing to do (would be nice to log this somewhere though),
|
||||||
// but a rejected promise needs to be handled here so that a resolved
|
// but a rejected promise needs to be handled here so that a resolved
|
||||||
|
Loading…
Reference in New Issue
Block a user