Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ common_params:
# - '6.4'
# - '6.5'
# - '6.6'
- '6.8.1'
- 'beta-6.9-RC3'

steps:
#
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
context: .
dockerfile: wordpress.Dockerfile
args:
WORDPRESS_VERSION: ${WORDPRESS_VERSION:-6.8.1}
WORDPRESS_VERSION: ${WORDPRESS_VERSION:-beta-6.9-RC3}
container_name: 'wordpress'
ports:
- '80:80'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PostTypesEndpointTest {
val postTypesPost = client.request { requestBuilder ->
requestBuilder.postTypes().retrieveWithEditContext(PostType.Post)
}.assertSuccessAndRetrieveData().data
assert(postTypesPost.supports.map[PostTypeSupports.Title]!!)
assert(postTypesPost.supports.map[PostTypeSupports.Title]!!.asJsonBool()!!)
assertFalse(postTypesPost.capabilities[PostTypeCapabilities.EditPosts]!!.isEmpty())
}

Expand Down
7 changes: 4 additions & 3 deletions wordpress.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG WORDPRESS_VERSION="6.8.1"
ARG WORDPRESS_VERSION="beta-6.9-RC3"

FROM public.ecr.aws/docker/library/wordpress:${WORDPRESS_VERSION}
# Using Docker Hub directly since ECR doesn't mirror beta/RC tags
FROM docker.io/library/wordpress:${WORDPRESS_VERSION}

RUN apt-get update \
&& apt-get install -y wget gpg
Expand Down Expand Up @@ -62,7 +63,7 @@ ENV PATH="/root/.local/share/swiftly/bin:$PATH"
RUN curl -s -o swiftly.tar.gz "https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz" \
&& tar zxf swiftly.tar.gz \
&& rm swiftly.tar.gz \
&& ./swiftly init --assume-yes --skip-install
&& ./swiftly init --assume-yes --skip-install --platform debian12
RUN apt-get update \
&& apt-get -y -qq install libicu-dev libcurl4-openssl-dev libedit-dev libsqlite3-dev \
libncurses-dev libpython3-dev libxml2-dev uuid-dev git libstdc++-12-dev
Expand Down
26 changes: 24 additions & 2 deletions wp_api/src/post_types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::impl_as_query_value_from_to_string;
use crate::{JsonValue, impl_as_query_value_from_to_string};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::str::FromStr;
use std::sync::Arc;
use wp_contextual::WpContextual;
use wp_serde_helper::deserialize_empty_array_or_hashmap;

Expand Down Expand Up @@ -97,7 +98,28 @@ pub struct PostTypeSupportsMap {
#[serde(deserialize_with = "deserialize_empty_array_or_hashmap")]
#[serde(flatten)]
#[serde(rename = "supports")]
pub map: HashMap<PostTypeSupports, bool>,
pub map: HashMap<PostTypeSupports, Arc<PostTypeSupportsValue>>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, uniffi::Object)]
#[serde(transparent)]
pub struct PostTypeSupportsValue {
#[serde(flatten)]
pub json_value: JsonValue,
}

#[uniffi::export]
impl PostTypeSupportsValue {
fn as_json_value(&self) -> JsonValue {
self.json_value.clone()
}

pub fn as_json_bool(&self) -> Option<bool> {
match self.json_value {
JsonValue::Bool(b) => Some(b),
_ => None,
}
}
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, uniffi::Record)]
Expand Down
8 changes: 6 additions & 2 deletions wp_api_integration_tests/tests/test_post_types_immut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ async fn retrieve_post_types_with_edit_context(
// post types might not support `Title` in which case it's perfectly fine to completely
// remove this assertion.
assert_eq!(
post_type.supports.map.get(&PostTypeSupports::Title),
Some(true).as_ref()
post_type
.supports
.map
.get(&PostTypeSupports::Title)
.and_then(|v| v.as_json_bool()),
Some(true)
);
// All post types in our current testing sites have `EditPost` capability, so we use this
// assertion to verify that we are able to parse `capabilities` field properly.
Expand Down