Posts: follow-ups from self-hosted discussion defaults (#26356)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- objective-c, swift
- Lĩnh vực
- mobile
Hướng nghiên cứu
Start with PostRepository._create, BlogService+Settings.swift, RemotePostParameters.swift, and the TODO describing the discussion settings refactor. First check whether wp.getOptions works for authors and editors, then trace how unknown defaults reach wp.newPost; the issue also identifies a stale settings behavior and a documentation cleanup. Done means addressing the unknown-default case, documenting the remaining refactor work, and correcting the outdated comment.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
From Claude:
These are the non-blocking findings from reviewing #26356 at ad746cb8fa. That PR makes new self-hosted posts keep the site's discussion defaults when they're created over XML-RPC. It works as described and was approved. The items below are gaps it leaves, not regressions that block it.
-
When the site's discussion defaults aren't known yet, new posts created over XML-RPC still get comments closed.
What happens:
wp.newPostcloses comments whencomment_statusis left out, even on a site that defaults to open. #26356 fixes this by sending the saved site default. When the app hasn't saved the defaults yet, the status is unknown, the field is left out, and the server closes comments.When it happens:
- The settings fetch hasn't finished yet, for example the first post right after adding a site.
- The settings fetch failed.
- A local draft was saved before upgrading to the version with #26356.
What the user sees: a new post published with comments closed, although the site allows comments.
Suggested fix: don't wait for the background settings sync. It only runs on a cold launch, pull to refresh or a site switch, it may already have failed, and it fetches every setting. Instead, in
PostRepository._create, when creating apostover XML-RPC with the comment status still unknown, make one targeted call first:wp.getOptions(blogID, user, pass, ["default_comment_status", "default_ping_status"])- Fill in the unknown statuses from the response before
wp.newPost. - Save them to
blog.settingsso the next post doesn't need the call. - If the call fails, keep the current behaviour (leave the fields out) and log it.
- This costs one extra request, only while the defaults are unknown.
- Check first whether
wp.getOptionsworks for authors and editors./wp/v2/settingsneedsmanage_options;wp.getOptionsis believed not to, but that hasn't been tested.
How this was checked: on a local WordPress 7.1.4 site,
wp.newPostwithcomment_statusleft out saved the post with comments closed and pings open while the site default was open/open. The unknown-defaults case itself was confirmed by reading the code, not reproduced in the app. -
If the site's default changes while the app is open, new posts keep using the old default until the app refreshes its settings.
What happens:
Blog.createPost()copies the saved site default onto every new post, and #26356 now sends that value explicitly over XML-RPC. If an admin changes the default in wp-admin, new posts from the app follow the old value until a cold launch or a pull to refresh on My Site. Going back to the Posts screen doesn't refresh it.Who is affected: self-hosted sites saving posts over XML-RPC. On sites using Core REST (XML-RPC off), the app already sent the saved defaults explicitly before #26356, so this is pre-existing there.
How this was checked: in the app on a simulator, with the saved defaults at open/open, the site default was changed to closed/closed over XML-RPC and a new draft was saved without relaunching. The server saved it with comments open and pings open. After a cold launch, the saved defaults updated to closed/closed and the next draft was saved closed/closed.
Suggested fix: by save time the app can't tell a value the user chose from one copied from the site default, so it can't know which ones to refresh. Fixing it means tracking whether the user changed the setting. That is the
RemotePostDiscussionSettingsrefactor described in the TODO inRemotePostParameters.swift. Low impact; fine to fold into that refactor. -
Cleanup.
- The doc comment on
combinedSettingsinBlogService+Settings.swiftstill says the XML-RPC fallback only supplies name, tagline and privacy. Since #26356 its settings also carry the discussion defaults (they're used when the Core REST fetch fails, for example for non-admin users). - #26356 reformatted one unrelated
#expectline inRemotePostCreateParametersTests.swift.
- The doc comment on
- Ngôn ngữ chính
- Swift
- Star
- 3.9k
- Fork
- 1.2k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 136
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của wordpress-mobile/WordPress-iOS
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Status] Ready for Dev [Type] Bug Reader
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
wordpress-mobile/WordPress-iOS#26254 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của wordpress-mobile/WordPress-iOS
Issue tương tự
-
Optional callbacks log "Unable to create JSCallback" when passed nullCó thể đã có người làm @cmsj đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
cmsj/Hammerspoon2#464 ·
-
android bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
VocaHQ/vocaphone#470 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
new-compilers request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
compiler-explorer/compiler-explorer#9640 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100