Sync site discussion defaults from Core REST site settings#25542
Sync site discussion defaults from Core REST site settings#25542crazytonyli wants to merge 2 commits into
Conversation
Pre-formatting before fixing the discussion defaults mapping.
Map wordpress-rs `defaultCommentStatus` and `defaultPingStatus` onto `RemoteBlogSettings.commentsAllowed` and `pingbackInboundEnabled` so self-hosted sites' Core Data caches reflect the actual server-side discussion defaults instead of being coerced to false.
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32169 | |
| Version | PR #25542 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 80255a1 | |
| Installation URL | 7lfoc5snp5e20 |
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32169 | |
| Version | PR #25542 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 80255a1 | |
| Installation URL | 0j1ovjecvt2p8 |
| settings.commentsAllowed = siteSettings.defaultCommentStatus | ||
| .map { NSNumber(value: $0.allowsDiscussion) } | ||
| settings.pingbackInboundEnabled = siteSettings.defaultPingStatus | ||
| .map { NSNumber(value: $0.allowsDiscussion) } |
There was a problem hiding this comment.
What happens here if the user isn't an admin? (IINM this is the API that's only exposed to admin-level users?)
There was a problem hiding this comment.
The REST API returns 403, so this code block won't be called.
There was a problem hiding this comment.
So then if the 403 happens, do these just default to false from the user perspective? Or do we hide the settings entirely from the user's view?
There was a problem hiding this comment.
I think we should read and use these default settings when creating a new post, but we don't do that at the moment. #25543 fixes that in the new editor. But the Core Data post editor still does not read them.
The above is when the settings are available. When they are not, I agree with you that we should hide the toggles on the Post Settings screen. That is not the case at the moment. I can create a Linear issue to track this bug.
There was a problem hiding this comment.
Two issues created: https://linear.app/a8c/issue/CMM-2076 and https://linear.app/a8c/issue/CMM-2077


Description
This PR applies the "Allow comments" and "Enable Pingback" site settings to the
Blog.settings.The first commit simply formats Swift code. The meaningful changes are in the second commit.