From 49108c230b4d3a4aac74f2139ccc23019be23e38 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 14 Dec 2015 17:58:39 -0800 Subject: regenerate the item body for linked photo items that now have no body to provide legal activities when going to other networks. Remove the signature since the signed text was an empty string and we've just replaced it with content that will not verify. --- include/bb2diaspora.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/bb2diaspora.php') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 1be7caa19..e2ce3f1b0 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -333,6 +333,17 @@ function bb2diaspora_itembody($item, $force_update = false) { } } + + // since November 2015 linked photo items don't or at least may not have a body. Recreate one. + + if(($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO) && (! trim($item['body']))) { + $j = json_decode($item['object'],true); + if($j) { + $item['body'] = $j['bbcode']; + $item['sig'] = ''; + } + } + $newitem = $item; if(array_key_exists('item_obscured',$item) && intval($item['item_obscured'])) { @@ -346,6 +357,7 @@ function bb2diaspora_itembody($item, $force_update = false) { } } + bb2diaspora_itemwallwall($newitem); $title = $newitem['title']; -- cgit v1.2.3 From 2924b9182e787d0266e433169b1db1c3fdd359a7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 15 Dec 2015 15:01:54 -0800 Subject: revise the photo activity a bit so that we always have a valid activity body. Several network connectors can get empty posts or posts that don't contain any reference whatsoever to the actual photo. Since this can cause duplicate images on our own site, just provide the activity summary and any included body text to the activity by default. Provide a function to enhance this activity with an actual photo which can be applied on demand for any network connectors that desire it. Otherwise they'll just get a link to the photo in the activity statement - which is better than an empty post. Have applied this "add actual photo to the post" function to both Diaspora and RSS feeds. Also provide the album as the activity target. --- include/bb2diaspora.php | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'include/bb2diaspora.php') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index e2ce3f1b0..81b95b30b 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -305,15 +305,6 @@ function bb2diaspora_itembody($item, $force_update = false) { $matches = array(); - //if we have a photo item just prepend the photo bbcode to item['body'] - $is_photo = (($item['obj_type'] == ACTIVITY_OBJ_PHOTO) ? true : false); - if($is_photo) { - $object = json_decode($item['object'],true); - if($object['bbcode']) { - $item['body'] = (($item['body']) ? $object['bbcode'] . "\r\n" . $item['body'] : $object['bbcode']); - } - } - if(($item['diaspora_meta']) && (! $force_update)) { $diaspora_meta = json_decode($item['diaspora_meta'],true); if($diaspora_meta) { @@ -333,16 +324,7 @@ function bb2diaspora_itembody($item, $force_update = false) { } } - - // since November 2015 linked photo items don't or at least may not have a body. Recreate one. - - if(($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO) && (! trim($item['body']))) { - $j = json_decode($item['object'],true); - if($j) { - $item['body'] = $j['bbcode']; - $item['sig'] = ''; - } - } + create_export_photo_body($item); $newitem = $item; -- cgit v1.2.3