Commit 6ef11fa1 authored by Mario's avatar Mario

pubcrawl: fix announce in regard to recent changes in pubcrawl_import_author()...

pubcrawl: fix announce in regard to recent changes in pubcrawl_import_author() and add attributeTo to asencode_item()
parent d352da7f
......@@ -46,16 +46,19 @@ class Inbox extends \Zotlabs\Web\Controller {
if($AS->type == 'Announce' && is_array($AS->obj) && array_key_exists('attributedTo',$AS->obj)) {
$arr = [
'url' => $AS->obj['attributedTo']
];
$arr['author']['url'] = $AS->obj['attributedTo'];
$x = pubcrawl_import_author($arr);
pubcrawl_import_author($arr);
if($x) {
$AS->sharee = $x;
if($arr['result']) {
$x['hash'] = $arr['result'];
}
else {
$x['address'] = $AS->obj['attributedTo'];
}
$AS->sharee = xchan_fetch($x);
if(! $AS->sharee) {
//TODO: what do we do with sharees from other networks (for now mainly gnusocial)?
logger('got announce activity but could not import share author');
return;
......
......@@ -186,6 +186,8 @@ function asencode_item($i) {
'href' => $i['plink']
];
$ret['attributedTo'] = $i['owner']['xchan_addr'];
$cnv = null;
if($i['id'] != $i['parent']) {
......@@ -1256,10 +1258,10 @@ function as_announce_note($channel,$observer_hash,$act) {
$s['attach'] = $a;
}
$body = "[share author='" . urlencode($act->sharee['xchan_name']) .
"' profile='" . $act->sharee['xchan_url'] .
"' avatar='" . $act->sharee['xchan_photo_s'] .
"' link='" . $act->obj['url'] .
$body = "[share author='" . urlencode($act->sharee['name']) .
"' profile='" . $act->sharee['url'] .
"' avatar='" . $act->sharee['photo_s'] .
"' link='" . ((is_array($act->obj['url'])) ? $act->obj['url']['href'] : $act->obj['url']) .
"' auth='" . ((is_matrix_url($act->obj['url'])) ? 'true' : 'false' ) .
"' posted='" . $act->obj['published'] .
"' message_id='" . $act->obj['id'] .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment