Posts: follow-ups from self-hosted discussion defaults (#26356)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- objective-c, swift
- Ambito
- mobile
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Swift
- Stelle
- 3.9k
- Fork
- 1.2k
- Merge medio
- 1g 23h
- PR unite (30g)
- 136
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wordpress-mobile/WordPress-iOS
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Status] Ready for Dev [Type] Bug Reader
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
wordpress-mobile/WordPress-iOS#26254 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wordpress-mobile/WordPress-iOS
Issue simili
-
Optional callbacks log "Unable to create JSCallback" when passed nullForse già presa @cmsj l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
cmsj/Hammerspoon2#464 ·
-
android bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
VocaHQ/vocaphone#470 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
new-compilers request
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
compiler-explorer/compiler-explorer#9640 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100