You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4c08086
Browse filesBrowse the repository at this point in the historyBrowse files
Show media on GoDAM's public routes only where WordPress would show it
The preview and embed pages, the video shortcode, ad tag and transcoding
status routes, and the video gallery listing now follow WordPress's own
media visibility instead of answering for any media ID.
Media is shown when it is unattached, or when the post it was uploaded to
is published (or has another public status) and has no password the
visitor has not entered. Users who can edit the media always see it, and
users who can read a private or draft parent, or edit a password-protected
one, see its media. Media used on a publicly viewable post counts as
public whichever post it was uploaded to, using the media usage index, so
a video uploaded while drafting one post keeps working in the player,
gallery, lightbox and embed of the published page that uses it. Media a
visitor may not see is treated like a missing ID. The result can be
adjusted with the new rtgodam_can_view_attachment filter.
- rtgodam_can_view_attachment() answers for one attachment; the gallery
listing applies the same rule in SQL (rtgodam_public_media_query_clauses)
so paging and counts stay correct.
- The transcoding status route takes at most 100 IDs per request and leaves
out IDs the user may not see. Reading the status no longer writes: the
short wait for a thumbnail after transcoding is based on the time of the
last status update, stored when the status is set, instead of a counter
incremented on every read. The media library requests statuses in batches
of 100.
- The rtgodam_meta REST field on attachments returns the stored settings
only to users who can write posts (for editor previews) or edit the
attachment.
- Video schema is printed only for posts whose content is public: not
drafts, private, scheduled or password-protected posts.
- Add unit tests for each of these.
$post = get_post( $post_id ); // godam-coverage-ignore -- is_post_content_public(): $post_id is the queried post (the current page), never an attachment.
* Outputs structured data for VideoObject schema on singular pages.
915
932
*
@@ -933,6 +950,12 @@ public function add_video_seo_schema() {
933
950
return;
934
951
}
935
952
953
+
// The cached schema describes the post's content, so only print it where
954
+
// that content is public.
955
+
if ( ! $this->is_post_content_public( $post_id ) ) {
956
+
return;
957
+
}
958
+
936
959
// Read cached SEO schema from post meta (fast!).
937
960
$cached_schemas = get_post_meta( $post_id, self::VIDEO_SEO_SCHEMA_META_KEY, true ); // godam-coverage-ignore -- add_video_seo_schema(): $post_id is get_queried_object_id() (the current page); reads that page's own cached SEO meta, not attachment data.
938
961
@@ -1852,6 +1875,11 @@ public function output_render_time_video_seo_schema() {
1852
1875
// as an unrelated post (description fallback, re-save queue, clip URLs).
0 commit comments