Skip to content

Update wordpress-rs to 0.8.0 - #25986

Merged
crazytonyli merged 7 commits into
trunkfrom
task/update-wordpress-rs-0.8.0
Sep 3, 2026
Merged

Update wordpress-rs to 0.8.0#25986
crazytonyli merged 7 commits into
trunkfrom
task/update-wordpress-rs-0.8.0

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

No description provided.

Application password created/lastUsed and user registeredDate now arrive as Date instead of strings, so drop the manual parsing.
The field is nil only for a never-published comment, which the moderation list never shows, so fall back to distantPast.
wordpress-rs 0.8.0 delivers the site-timezone date and modified fields as WpDateString instead of String.
wordpress-rs 0.8.0 moved the WordPress.com locale from per-endpoint params to a client-level language provider. Register one on both WP.com clients so responses are localized to the user's preferred language. The provider maps the language through the wordpress-rs table rather than the bundled Languages.json, so regional variants resolve and unsupported languages send no locale.
@dangermattic

dangermattic commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@crazytonyli
crazytonyli requested a review from jkmassel September 3, 2026 08:20
@crazytonyli crazytonyli added the Tooling Build, Release, and Validation Tools label Sep 3, 2026
@crazytonyli crazytonyli added this to the 27.3 milestone Sep 3, 2026
@crazytonyli
crazytonyli marked this pull request as ready for review September 3, 2026 08:20
@wpmobilebot

wpmobilebot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number34355
VersionPR #25986
Bundle IDorg.wordpress.alpha
Commit4ffe4a1
Installation URL3eec2qad2vl10
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number34355
VersionPR #25986
Bundle IDcom.jetpack.alpha
Commit4ffe4a1
Installation URL6o35ni6britjo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jkmassel jkmassel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things for discussion

date = comment.dateGmt
// `dateGmt` became optional in wordpress-rs 0.8.0 (nil only for a
// never-published comment, which the moderation list never shows).
date = comment.dateGmt ?? .distantPast

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like maybe we should make this optional instead of assigning a technically-invalid date, but WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b361874

/// table, so regional variants such as `en-gb` resolve and unsupported languages send no locale.
final class WPComDeviceLanguageProvider: WpComLanguageProvider {
func currentLanguage() -> WpComLanguage? {
guard let identifier = Locale.preferredLanguages.first else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should iterate preferredLanguages and take the first match – maybe the first one doesn't resolve to a WP.com language, but the second does?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Addressed in 4ffe4a1

///
/// Reads the same source as `WordPressComRestApi` but maps it through the wordpress-rs language
/// table, so regional variants such as `en-gb` resolve and unsupported languages send no locale.
final class WPComDeviceLanguageProvider: WpComLanguageProvider {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should've put this in wprs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

wordpress-rs 0.8.0 delivers the comment's GMT date as optional. Carry nil through CommentListItem, CommentDetail, and the detail header instead of substituting distantPast, and omit the date text in the row, author header, and info sheet when it is missing.
Walk Locale.preferredLanguages in order instead of stopping at the first entry, so a user whose top language WordPress.com does not support still gets their next preference rather than no locale.
@crazytonyli
crazytonyli requested a review from jkmassel September 3, 2026 21:18
@crazytonyli
crazytonyli added this pull request to the merge queue Sep 3, 2026
Merged via the queue into trunk with commit a264e00 Sep 3, 2026
28 checks passed
@crazytonyli
crazytonyli deleted the task/update-wordpress-rs-0.8.0 branch September 3, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tooling Build, Release, and Validation Tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants