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 ++++++++++++ include/items.php | 10 ++++++++++ 2 files changed, 22 insertions(+) (limited to 'include') 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']; diff --git a/include/items.php b/include/items.php index 8c2e7deb2..4d49a5191 100755 --- a/include/items.php +++ b/include/items.php @@ -3950,6 +3950,16 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { return '' . "\r\n"; + // 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'] = ''; + } + } + if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) $body = fix_private_photos($item['body'],$owner['uid'],$item,$cid); else -- cgit v1.2.3