🐛 Fixed "Unsaved post" modal shown when updating visibility in post settings (#21511)

Ref:
https://linear.app/ghost/issue/ENG-661/unsaved-changes-when-post-has-not-been-edited
This commit is contained in:
Princi Vershwal 2024-11-04 13:12:47 +05:30 committed by GitHub
parent d91869e640
commit a57d364d32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View File

@ -191,3 +191,4 @@ add|ember-template-lint|no-action|73|82|73|82|f30d469e4ae668f05aca2f92a124a6b474
remove|ember-template-lint|no-action|73|76|73|76|7d339c0f3d02ec863651697ad8e8105158d858f1|1730678400000|1741046400000|1746230400000|app/components/gh-post-settings-menu.hbs
add|ember-template-lint|no-action|5|14|5|14|a90edd9a99596008f60bfcdbc6befe7fe8d26321|1730678400000|1741046400000|1746230400000|app/components/gh-psm-tags-input.hbs
remove|ember-template-lint|no-action|5|14|5|14|88b11bf43be33d97824ebac071a563affac0b97d|1730678400000|1741046400000|1746230400000|app/components/gh-psm-tags-input.hbs
add|ember-template-lint|no-action|80|92|80|92|f30d469e4ae668f05aca2f92a124a6b4748847a3|1730678400000|1741046400000|1746230400000|app/components/gh-post-settings-menu.hbs

View File

@ -77,7 +77,7 @@
{{#if this.showVisibilityInput}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="visibility">
<label for="visibility-input">{{capitalize @post.displayName}} access</label>
<GhPsmVisibilityInput @post={{this.post}} @triggerId="visibility-input" />
<GhPsmVisibilityInput @post={{this.post}} @savePostOnChange={{action "savePost"}} @triggerId="visibility-input" />
</GhFormGroup>
{{#if (eq this.post.visibility "tiers")}}

View File

@ -35,5 +35,8 @@ export default class GhPsmVisibilityInput extends Component {
if (newVisibility !== 'tiers') {
this.post.set('tiers', []);
}
if (this.savePostOnChange) {
return this.savePostOnChange();
}
}
}