1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

🐛 Fix save button showing "Retry" when user slug field loses focus (#834)

no issue
- the `updateSlug` task never returned a value if there was no change needed, this meant that giving the slug field focus then blurring it again caused the "Save" button to become red with "Retry" text
- always return true from `updateSlug` - this stops the button from showing "Retry" and will instead show "Saved" which is a little less confusing
This commit is contained in:
Kevin Ansfield 2017-08-22 08:59:49 +01:00 committed by Aileen Nowak
parent 88449ed639
commit 8c2f054b04

View file

@ -129,7 +129,7 @@ export default Controller.extend({
if (!newSlug || slug === newSlug) {
this.set('slugValue', slug);
return;
return true;
}
let serverSlug = yield this.get('slugGenerator').generateSlug('user', newSlug);
@ -137,7 +137,7 @@ export default Controller.extend({
// If after getting the sanitized and unique slug back from the API
// we end up with a slug that matches the existing slug, abort the change
if (serverSlug === slug) {
return;
return true;
}
// Because the server transforms the candidate slug by stripping
@ -156,11 +156,12 @@ export default Controller.extend({
if (slug === slugTokens.join('-') && serverSlug !== newSlug) {
this.set('slugValue', slug);
return;
return true;
}
}
this.set('slugValue', serverSlug);
return true;
}).group('saveHandlers'),
save: task(function* () {