Custom Posts: Show "Post updated" notice#25576
Conversation
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32328 | |
| Version | PR #25576 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | caae1e1 | |
| Installation URL | 53fqj57lk68to |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32328 | |
| Version | PR #25576 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | caae1e1 | |
| Installation URL | 7docmtoa5gbo0 |
Post a Notice toast on every HTTP write to the site from the Custom Post editor (save draft, update, publish) and from the standalone settings sheet reached from the Custom Posts list. The notice's title reflects the action: "Draft saved" only on the first save of a brand-new post, "Post updated" for any save of an existing post, and "Post published" via the publishing sheet. The post title is the notice's subtitle (omitted when empty). Localized strings live in a shared CustomPostNotice enum.
6c9a5a3 to
caae1e1
Compare
jkmassel
left a comment
There was a problem hiding this comment.
Left a comment, but also publishPost notifies now but what about moveToDraft, trashPost, and deletePost?
| editorService: editorService, | ||
| blog: blog, | ||
| from: vc, | ||
| completion: { _ in } |
There was a problem hiding this comment.
Does this need a similar body to the one in showPublishingSheet?
| } | ||
| } | ||
|
|
||
| private enum Strings { |
There was a problem hiding this comment.
Is this a duplicate of the ViewModel strings?
WDYT about extracting them into a higher-level shared CustomPostNotice string set?
| @@ -251,6 +255,12 @@ private extension CustomPostEditorViewController { | |||
| func save(publish: Bool) async { | |||
There was a problem hiding this comment.
I think we only ever pass false here, so do we need this param? (this will cause a breaking change in callers)
| func save(publish: Bool) async { | |
| func save() async { |
| let postTitle = editorService.post?.title?.raw | ||
| let subtitle = (postTitle?.isEmpty == false) ? postTitle : nil | ||
| Notice(title: Strings.CustomPostNotice.postPublished, message: subtitle, feedbackType: .success) | ||
| .post() |
There was a problem hiding this comment.
We repeat this pattern a bunch – I wonder if we could extract it to a helper? Could be the enum you use to consolidate the strings?
I didn't touch those because the existing Posts list does not show a notice on these actions. |


Description
Mirror the existing UX: show notice after post is saved/published.
The first commit is code-format changes and can be ignored.