Skip to content

Commit 4a5814a

Browse files
[5.x] Fix after_save preference not persisting when default preferences override 'listing' (#13879)
Co-authored-by: Jason Varga <jason@pixelfear.com>
1 parent 5a6f472 commit 4a5814a

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

resources/js/components/entries/PublishForm.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ export default {
504504
},
505505
506506
afterSaveOption() {
507-
return this.getPreference('after_save');
507+
return this.getPreference('after_save') ?? 'listing';
508508
},
509509
510510
originOptions() {
@@ -622,8 +622,8 @@ export default {
622622
window.location = this.createAnotherUrl;
623623
}
624624
625-
// If the user has opted to go to listing (default/null option), redirect them there.
626-
else if (!this.isInline && nextAction === null) {
625+
// If the user has opted to go to listing, redirect them there.
626+
else if (!this.isInline && nextAction === 'listing') {
627627
window.location = this.listingUrl;
628628
}
629629
@@ -794,8 +794,8 @@ export default {
794794
window.location = this.createAnotherUrl;
795795
}
796796
797-
// If the user has opted to go to listing (default/null option), redirect them there.
798-
else if (!this.isInline && nextAction === null) {
797+
// If the user has opted to go to listing, redirect them there.
798+
else if (!this.isInline && nextAction === 'listing') {
799799
window.location = this.listingUrl;
800800
}
801801

resources/js/components/publish/SaveButtonOptions.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ export default {
9292
setPreference(value) {
9393
if (value === this.$preferences.get(this.preferencesKey)) return;
9494
95-
value === 'listing'
96-
? this.$preferences.remove(this.preferencesKey)
97-
: this.$preferences.set(this.preferencesKey, value);
95+
this.$preferences.set(this.preferencesKey, value);
9896
},
9997
},
10098

resources/js/components/terms/PublishForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export default {
399399
},
400400
401401
afterSaveOption() {
402-
return this.getPreference('after_save');
402+
return this.getPreference('after_save') ?? 'listing';
403403
},
404404
405405
},
@@ -498,8 +498,8 @@ export default {
498498
window.location = this.createAnotherUrl;
499499
}
500500
501-
// If the user has opted to go to listing (default/null option), redirect them there.
502-
else if (!this.isInline && nextAction === null) {
501+
// If the user has opted to go to listing, redirect them there.
502+
else if (!this.isInline && nextAction === 'listing') {
503503
window.location = this.listingUrl;
504504
}
505505

0 commit comments

Comments
 (0)