<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][13342] trunk: Stop using the post link into the new_blog_post activity action</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/13342">13342</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/13342","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-10-22 09:45:12 +0000 (Sat, 22 Oct 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Stop using the post link into the new_blog_post activity action
Now the post link is included into the activity content (see <a href="http://buddypress.trac.wordpress.org/changeset/13305">[13305]</a>), displaying it into the activity action is no more needed.
This commit also :
- introduces a new function to get a site's URL and Name out of BP Blogs meta which avoids some code duplication in `new_blog`, `new_blog_post` and `new_blog_comment` activity action format callbacks.
- improves the `new_blog_post` activity content layout when the corresponding post's image is not the featured one.
- properly deprecates pre-2.0 activity action filters.
Props teeboy4real
Closes https://github.com/buddypress/buddypress/pull/27
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8052">#8052</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpblogsbpblogsactivityphp">trunk/src/bp-blogs/bp-blogs-activity.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacycssbuddypressrtlcss">trunk/src/bp-templates/bp-legacy/css/buddypress-rtl.css</a></li>
<li><a href="#trunksrcbptemplatesbplegacycssbuddypresscss">trunk/src/bp-templates/bp-legacy/css/buddypress.css</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaucommonstyles_bp_activity_entriesscss">trunk/src/bp-templates/bp-nouveau/common-styles/_bp_activity_entries.scss</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaucssbuddypressrtlcss">trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaucssbuddypresscss">trunk/src/bp-templates/bp-nouveau/css/buddypress.css</a></li>
<li><a href="#trunktestsphpunittestcasesblogsactivityphp">trunk/tests/phpunit/testcases/blogs/activity.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpblogsbpblogsactivityphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-blogs/bp-blogs-activity.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-blogs/bp-blogs-activity.php 2022-10-19 03:45:34 UTC (rev 13341)
+++ trunk/src/bp-blogs/bp-blogs-activity.php 2022-10-22 09:45:12 UTC (rev 13342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -115,6 +115,53 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_activity_get_post_type_tracking_args', 'bp_blogs_register_post_tracking_args', 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns the blog URL and name which relates to a post or comment activity.
+ *
+ * @since 11.0.0
+ *
+ * @param BP_Activity_Activity $activity The activity object.
+ * @return array The blog URL and name which relates to a post or comment activity.
+ */
+function bp_blogs_activity_get_site_link_meta( $activity = null ) {
+ $attributes = array(
+ 'blog_url' => '',
+ 'blog_name' => '',
+ );
+
+ if ( ! isset( $activity->item_id, $activity->component ) || ! $activity->item_id || 'blogs' !== $activity->component ) {
+ return $attributes;
+ }
+
+ if ( isset( $activity->blog_url ) ) {
+ $attributes['blog_url'] = $activity->blog_url;
+ } else {
+ $blog_url = bp_blogs_get_blogmeta( $activity->item_id, 'url' );
+
+ if ( ! $blog_url ) {
+ $blog_url = get_home_url( $activity->item_id );
+ bp_blogs_update_blogmeta( $activity->item_id, 'url', $blog_url );
+ } else {
+ $attributes['blog_url'] = $blog_url;
+ }
+ }
+
+ if ( isset( $activity->blog_name ) ) {
+ $attributes['blog_name'] = $activity->blog_name;
+ } else {
+ $blog_name = bp_blogs_get_blogmeta( $activity->item_id, 'name' );
+
+ if ( ! $blog_name ) {
+ $blog_name = get_blog_option( $activity->item_id, 'blogname' );
+ bp_blogs_update_blogmeta( $activity->item_id, 'name', $blog_name );
+ } else {
+ $attributes['blog_name'] = $blog_name;
+ }
+ }
+
+ return $attributes;
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Format 'new_blog' activity actions.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.0.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -121,11 +168,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $action Static activity action.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param object $activity Activity data object.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string Constructed activity action.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_blogs_format_activity_action_new_blog( $action, $activity ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $blog_url = bp_blogs_get_blogmeta( $activity->item_id, 'url' );
- $blog_name = bp_blogs_get_blogmeta( $activity->item_id, 'name' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $blog_url, $blog_name ) = array_values( bp_blogs_activity_get_site_link_meta( $activity ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $action = sprintf(
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: 1: the activity user link. 2: the blog link. */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,7 +188,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $recorded_blog ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $action = apply_filters( 'bp_blogs_activity_created_blog_action', $action, $recorded_blog, $blog_name, bp_blogs_get_blogmeta( $activity->item_id, 'description' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $blog_description = bp_blogs_get_blogmeta( $activity->item_id, 'description' );
+ $action = apply_filters_deprecated( 'bp_blogs_activity_created_blog_action', array( $action, $recorded_blog, $blog_name, $blog_description ), '2.0.0', 'bp_blogs_format_activity_action_new_blog' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -167,93 +214,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Constructed activity action.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_blogs_format_activity_action_new_blog_post( $action, $activity ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $blog_url = bp_blogs_get_blogmeta( $activity->item_id, 'url' );
- $blog_name = bp_blogs_get_blogmeta( $activity->item_id, 'name' );
-
- if ( empty( $blog_url ) || empty( $blog_name ) ) {
- $blog_url = get_home_url( $activity->item_id );
- $blog_name = get_blog_option( $activity->item_id, 'blogname' );
-
- bp_blogs_update_blogmeta( $activity->item_id, 'url', $blog_url );
- bp_blogs_update_blogmeta( $activity->item_id, 'name', $blog_name );
- }
-
- /**
- * When the post is published we are faking an activity object
- * to which we add 2 properties :
- * - the post url
- * - the post title
- * This is done to build the 'post link' part of the activity
- * action string.
- * NB: in this case the activity has not yet been created.
- */
- if ( isset( $activity->post_url ) ) {
- $post_url = $activity->post_url;
-
- /**
- * The post_url property is not set, we need to build the url
- * thanks to the post id which is also saved as the secondary
- * item id property of the activity object.
- */
- } else {
- $post_url = add_query_arg( 'p', $activity->secondary_item_id, trailingslashit( $blog_url ) );
- }
-
- // Should be the case when the post has just been published.
- if ( isset( $activity->post_title ) ) {
- $post_title = $activity->post_title;
-
- // If activity already exists try to get the post title from activity meta.
- } else if ( ! empty( $activity->id ) ) {
- $post_title = bp_activity_get_meta( $activity->id, 'post_title' );
- }
-
- /**
- * In case the post was published without a title
- * or the activity meta was not found.
- */
- if ( empty( $post_title ) ) {
- // Defaults to no title.
- $post_title = __( '(no title)', 'buddypress' );
-
- switch_to_blog( $activity->item_id );
-
- $post = get_post( $activity->secondary_item_id );
- if ( is_a( $post, 'WP_Post' ) ) {
- // Does the post have a title ?
- if ( ! empty( $post->post_title ) ) {
- $post_title = $post->post_title;
- }
-
- // Make sure the activity exists before saving the post title in activity meta.
- if ( ! empty( $activity->id ) ) {
- bp_activity_update_meta( $activity->id, 'post_title', $post_title );
- }
- }
-
- restore_current_blog();
- }
-
- // Build the 'post link' part of the activity action string.
- $post_link = '<a href="' . esc_url( $post_url ) . '">' . esc_html( $post_title ) . '</a>';
-
</del><span class="cx" style="display: block; padding: 0 10px"> $user_link = bp_core_get_userlink( $activity->user_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Build the complete activity action string.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $blog_url, $blog_name ) = array_values( bp_blogs_activity_get_site_link_meta( $activity ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $action = sprintf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: 1: the activity user link. 2: the post link. 3: the blog link. */
- esc_html_x( '%1$s wrote a new post, %2$s, on the site %3$s', '`new_blog_post` activity action', 'buddypress' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* translators: 1: the activity user link. 2: the blog link. */
+ esc_html_x( '%1$s wrote a new post on the site %2$s', 'Multisite `new_blog_post` activity action', 'buddypress' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> $user_link,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_link,
</del><span class="cx" style="display: block; padding: 0 10px"> '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $action = sprintf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: 1: the activity user link. 2: the post link. */
- esc_html_x( '%1$s wrote a new post, %2$s', '`new_blog_post` activity action', 'buddypress' ),
- $user_link,
- $post_link
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* translators: 1: the activity user link. */
+ esc_html_x( '%s wrote a new post', '`new_blog_post` activity action', 'buddypress' ),
+ $user_link
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -264,7 +241,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> restore_current_blog();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $post ) && ! is_wp_error( $post ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $action = apply_filters( 'bp_blogs_activity_new_post_action', $action, $post, $post_url );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post_url = add_query_arg( 'p', $post->ID, trailingslashit( get_home_url( $activity->item_id ) ) );
+ $action = apply_filters_deprecated( 'bp_blogs_activity_new_post_action', array( $action, $post, $post_url ), '2.0.0', 'bp_blogs_format_activity_action_new_blog_post' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -300,35 +278,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * action string.
</span><span class="cx" style="display: block; padding: 0 10px"> * NB: in this case the activity has not yet been created.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $blog_url, $blog_name ) = array_values( bp_blogs_activity_get_site_link_meta( $activity ) );
+ $post_url = false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $blog_url = false;
-
- // Try to get the blog url from the activity object.
- if ( isset( $activity->blog_url ) ) {
- $blog_url = $activity->blog_url;
- } else {
- $blog_url = bp_blogs_get_blogmeta( $activity->item_id, 'url' );
- }
-
- $blog_name = false;
-
- // Try to get the blog name from the activity object.
- if ( isset( $activity->blog_name ) ) {
- $blog_name = $activity->blog_name;
- } else {
- $blog_name = bp_blogs_get_blogmeta( $activity->item_id, 'name' );
- }
-
- if ( empty( $blog_url ) || empty( $blog_name ) ) {
- $blog_url = get_home_url( $activity->item_id );
- $blog_name = get_blog_option( $activity->item_id, 'blogname' );
-
- bp_blogs_update_blogmeta( $activity->item_id, 'url', $blog_url );
- bp_blogs_update_blogmeta( $activity->item_id, 'name', $blog_name );
- }
-
- $post_url = false;
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Try to get the post url from the activity object.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $activity->post_url ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_url = $activity->post_url;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -401,7 +353,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> restore_current_blog();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $comment ) && ! is_wp_error( $comment ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $action = apply_filters( 'bp_blogs_activity_new_comment_action', $action, $comment, $post_url . '#' . $activity->secondary_item_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $action = apply_filters_deprecated( 'bp_blogs_activity_new_comment_action', array( $action, $comment, $post_url . '#' . $activity->secondary_item_id ), '2.0.0', 'bp_blogs_format_activity_action_new_blog_comment' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacycssbuddypressrtlcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/css/buddypress-rtl.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/css/buddypress-rtl.css 2022-10-19 03:45:34 UTC (rev 13341)
+++ trunk/src/bp-templates/bp-legacy/css/buddypress-rtl.css 2022-10-22 09:45:12 UTC (rev 13342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -332,6 +332,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> #buddypress .activity-list li.new_blog_post .activity-content .activity-inner img {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ max-width: 100%;
</ins><span class="cx" style="display: block; padding: 0 10px"> float: right;
</span><span class="cx" style="display: block; padding: 0 10px"> margin-left: 0.8em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacycssbuddypresscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/css/buddypress.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/css/buddypress.css 2022-10-19 03:45:34 UTC (rev 13341)
+++ trunk/src/bp-templates/bp-legacy/css/buddypress.css 2022-10-22 09:45:12 UTC (rev 13342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -332,6 +332,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> #buddypress .activity-list li.new_blog_post .activity-content .activity-inner img {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ max-width: 100%;
</ins><span class="cx" style="display: block; padding: 0 10px"> float: left;
</span><span class="cx" style="display: block; padding: 0 10px"> margin-right: 0.8em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaucommonstyles_bp_activity_entriesscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/common-styles/_bp_activity_entries.scss</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/common-styles/_bp_activity_entries.scss 2022-10-19 03:45:34 UTC (rev 13341)
+++ trunk/src/bp-templates/bp-nouveau/common-styles/_bp_activity_entries.scss 2022-10-22 09:45:12 UTC (rev 13342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -100,6 +100,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> img {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ max-width: 100%;
</ins><span class="cx" style="display: block; padding: 0 10px"> float: left;
</span><span class="cx" style="display: block; padding: 0 10px"> margin-right: 0.8em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaucssbuddypressrtlcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css 2022-10-19 03:45:34 UTC (rev 13341)
+++ trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css 2022-10-22 09:45:12 UTC (rev 13342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1312,6 +1312,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .activity-list .activity-item.new_blog_post .activity-inner img {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ max-width: 100%;
</ins><span class="cx" style="display: block; padding: 0 10px"> float: right;
</span><span class="cx" style="display: block; padding: 0 10px"> margin-left: 0.8em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaucssbuddypresscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/css/buddypress.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/css/buddypress.css 2022-10-19 03:45:34 UTC (rev 13341)
+++ trunk/src/bp-templates/bp-nouveau/css/buddypress.css 2022-10-22 09:45:12 UTC (rev 13342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1312,6 +1312,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .activity-list .activity-item.new_blog_post .activity-inner img {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ max-width: 100%;
</ins><span class="cx" style="display: block; padding: 0 10px"> float: left;
</span><span class="cx" style="display: block; padding: 0 10px"> margin-right: 0.8em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestcasesblogsactivityphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/testcases/blogs/activity.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/testcases/blogs/activity.php 2022-10-19 03:45:34 UTC (rev 13341)
+++ trunk/tests/phpunit/testcases/blogs/activity.php 2022-10-22 09:45:12 UTC (rev 13342)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,13 +73,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $a_obj = new BP_Activity_Activity( $a );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $user_link = bp_core_get_userlink( $u );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $blog_url = get_home_url();
- $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );
- $post_title = bp_activity_get_meta( $a, 'post_title' );
- $post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected = sprintf( '%s wrote a new post', $user_link );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected = sprintf( '%s wrote a new post, %s', $user_link, $post_link );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( $expected, $a_obj->action );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -108,11 +103,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $user_link = bp_core_get_userlink( $u );
</span><span class="cx" style="display: block; padding: 0 10px"> $blog_url = get_home_url();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );
- $post_title = bp_activity_get_meta( $a, 'post_title' );
- $post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected = sprintf( '%s wrote a new post, %s, on the site %s', $user_link, $post_link, '<a href="' . $blog_url . '">' . bp_blogs_get_blogmeta( $a_obj->item_id, 'name' ) . '</a>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected = sprintf( '%s wrote a new post on the site %s', $user_link, '<a href="' . $blog_url . '">' . bp_blogs_get_blogmeta( $a_obj->item_id, 'name' ) . '</a>' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( $expected, $a_obj->action );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,11 +140,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $user_link = bp_core_get_userlink( $u );
</span><span class="cx" style="display: block; padding: 0 10px"> $blog_url = get_blog_option( $a_obj->item_id, 'home' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );
- $post_title = $p_obj->post_title;
- $post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected = sprintf( '%s wrote a new post, %s, on the site %s', $user_link, $post_link, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected = sprintf( '%s wrote a new post on the site %s', $user_link, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( $expected, $a_obj->action );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -203,93 +192,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @group bp_blogs_format_activity_action_new_blog
- */
- public function test_bp_activity_format_activity_action_new_blog_backpat() {
- if ( ! is_multisite() ) {
- $this->markTestSkipped();
- }
-
- add_filter( 'bp_blogs_activity_created_blog_action', array( $this, 'created_blog_passthrough' ), 10, 2 );
-
- $b = self::factory()->blog->create();
- $u = self::factory()->user->create();
-
- $recorded_blog = new BP_Blogs_Blog;
- $recorded_blog->user_id = $u;
- $recorded_blog->blog_id = $b;
- $recorded_blog_id = $recorded_blog->save();
-
- $a = self::factory()->activity->create( array(
- 'component' => buddypress()->blogs->id,
- 'type' => 'new_blog',
- 'user_id' => $u,
- 'item_id' => $b,
- ) );
-
- $this->assertEquals( $this->userblog_id, $recorded_blog_id );
- }
-
- /**
- * @group bp_blogs_format_activity_action_new_blog_post
- */
- public function test_bp_activity_format_activity_action_new_blog_post_backpat() {
- if ( ! is_multisite() ) {
- $this->markTestSkipped();
- }
-
- add_filter( 'bp_blogs_activity_new_post_action', array( $this, 'new_post_passthrough' ), 10, 2 );
-
- $b = self::factory()->blog->create();
-
- switch_to_blog( $b );
- $p = self::factory()->post->create();
- restore_current_blog();
-
- $u = self::factory()->user->create();
- $a = self::factory()->activity->create( array(
- 'component' => buddypress()->blogs->id,
- 'type' => 'new_blog_post',
- 'user_id' => $u,
- 'item_id' => $b,
- 'secondary_item_id' => $p,
- ) );
-
- $this->assertEquals( $this->post_id, $p );
- }
-
- /**
- * @group bp_blogs_format_activity_action_new_blog_comment
- */
- public function test_bp_activity_format_activity_action_new_blog_comment_backpat() {
- if ( ! is_multisite() ) {
- $this->markTestSkipped();
- }
-
- add_filter( 'bp_blogs_activity_new_comment_action', array( $this, 'new_comment_passthrough' ), 10, 2 );
-
- $b = self::factory()->blog->create();
-
- switch_to_blog( $b );
- $p = self::factory()->post->create();
- $c = self::factory()->comment->create( array(
- 'comment_post_ID' => $p,
- ) );
- restore_current_blog();
-
- $u = self::factory()->user->create();
- $a = self::factory()->activity->create( array(
- 'component' => buddypress()->blogs->id,
- 'type' => 'new_blog_comment',
- 'user_id' => $u,
- 'item_id' => $b,
- 'secondary_item_id' => $c,
- ) );
-
- $this->assertEquals( $this->comment_post_id, $p );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * @group post_type_comment_activities
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_bp_blogs_update_post_title_activity_meta_should_not_be_the_same_for_same_comment_id() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -388,102 +290,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $a_obj = new BP_Activity_Activity( $a );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( ! empty( $a_obj->action ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @group activity_action
- * @group bp_blogs_format_activity_action_new_blog_post
- */
- public function test_bp_blogs_format_activity_action_new_blog_post_no_title() {
- if ( is_multisite() ) {
- $this->markTestSkipped();
- }
-
- buddypress()->activity->actions = new stdClass();
-
- $u = self::factory()->user->create();
- $p = wp_insert_post( array(
- 'post_author' => $u,
- 'post_title' => '', // no title: the object of the test
- 'post_status' => 'publish',
- 'post_content' => 'foo bar',
- ) );
-
- $user_link = bp_core_get_userlink( $u );
- $blog_url = get_home_url();
- $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );
- $post_link = '<a href="' . $post_url . '">(no title)</a>';
-
- // Set activity actions
- bp_activity_get_actions();
-
- $a_obj = bp_activity_get( array(
- 'item_id' => 1,
- 'secondary_item_id' => $p,
- ) );
-
- $expected = sprintf( '%s wrote a new post, %s', $user_link, $post_link );
-
- $this->assertSame( $expected, $a_obj['activities'][0]->action );
- }
-
- /**
- * @group activity_action
- * @group bp_blogs_format_activity_action_new_blog_post
- */
- public function test_bp_blogs_format_activity_action_new_blog_post_updated_without_title() {
- if ( is_multisite() ) {
- $this->markTestSkipped();
- }
-
- buddypress()->activity->actions = new stdClass();
-
- $u = self::factory()->user->create();
- $p = wp_insert_post( array(
- 'post_author' => $u,
- 'post_title' => 'foo',
- 'post_status' => 'publish',
- 'post_content' => 'foo bar',
- ) );
-
- $user_link = bp_core_get_userlink( $u );
- $blog_url = get_home_url();
- $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );
- $post_title = get_the_title( $p );
- $post_link = '<a href="' . $post_url . '">' . $post_title . '</a>';
-
- // Set actions
- bp_activity_get_actions();
-
- $a_obj = bp_activity_get( array(
- 'item_id' => 1,
- 'secondary_item_id' => $p,
- ) );
-
- $expected = sprintf( '%s wrote a new post, %s', $user_link, $post_link );
-
- $this->assertSame( $expected, $a_obj['activities'][0]->action );
-
- // Update the post by removing its title
- wp_update_post( array(
- 'ID' => $p,
- 'post_title' => '',
- ) );
-
- // we now expect the (no title) post link
- $post_link = '<a href="' . $post_url . '">(no title)</a>';
- $expected = sprintf( '%s wrote a new post, %s', $user_link, $post_link );
-
- $a_obj = bp_activity_get( array(
- 'item_id' => 1,
- 'secondary_item_id' => $p,
- ) );
-
- $this->assertSame( $expected, $a_obj['activities'][0]->action );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * @group bp_blogs_sync_add_from_activity_comment
</span><span class="cx" style="display: block; padding: 0 10px"> * @group post_type_comment_activities
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre>
</div>
</div>
</body>
</html>