🐛 Fixed staff profile editing incorrectly showing saved state

closes https://github.com/TryGhost/Ghost/issues/11866

- Adds extra check to task button states if the last task ran was same as the current associated task
- In case of task groups, triggering one task in group also triggered states for other tasks in group
- Editing slug called `updateSlug` task which is part of the same task group as `save` task, which triggered the state for save button
This commit is contained in:
Rish 2020-06-08 13:01:18 +05:30 committed by Rishabh Garg
parent bb18d2a00b
commit 4a4a6cba3f

View File

@ -59,9 +59,11 @@ const GhTaskButton = Component.extend({
}),
isRunning: computed('task.last.isRunning', 'hasRun', 'showSuccess', function () {
let isRunning = this.get('task.last.isRunning');
let taskName = this.get('task.name');
let lastTaskName = this.get('task.last.task.name');
if (this.hasRun && this.get('task.last.value') && !this.showSuccess) {
let isRunning = (taskName === lastTaskName) && this.get('task.last.isRunning');
if (this.hasRun && (taskName === lastTaskName) && this.get('task.last.value') && !this.showSuccess) {
isRunning = true;
}
@ -73,12 +75,15 @@ const GhTaskButton = Component.extend({
}),
isSuccess: computed('hasRun', 'isRunning', 'task.last.value', function () {
let taskName = this.get('task.name');
let lastTaskName = this.get('task.last.task.name');
if (!this.hasRun || this.isRunning || !this.showSuccess) {
return false;
}
let value = this.get('task.last.value');
return !isBlank(value) && value !== false;
return (taskName === lastTaskName) && !isBlank(value) && value !== false;
}),
isSuccessClass: computed('isSuccess', function () {
@ -86,11 +91,14 @@ const GhTaskButton = Component.extend({
}),
isFailure: computed('hasRun', 'isRunning', 'isSuccess', 'task.last.error', function () {
let taskName = this.get('task.name');
let lastTaskName = this.get('task.last.task.name');
if (!this.hasRun || this.isRunning || this.isSuccess) {
return false;
}
return this.get('task.last.error') !== undefined;
return (taskName === lastTaskName) && this.get('task.last.error') !== undefined;
}),
isFailureClass: computed('isFailure', function () {