support photo items between zot and zot6
This commit is contained in:
parent
1b5dd8bbd7
commit
2fa274de1e
@ -434,6 +434,8 @@ class Notifier {
|
|||||||
$x['body'] = 'private';
|
$x['body'] = 'private';
|
||||||
logger('notifier: encoded item: ' . print_r($x,true), LOGGER_DATA, LOG_DEBUG);
|
logger('notifier: encoded item: ' . print_r($x,true), LOGGER_DATA, LOG_DEBUG);
|
||||||
|
|
||||||
|
//logger('notifier: encoded activity: ' . print_r($activity,true), LOGGER_DATA, LOG_DEBUG);
|
||||||
|
|
||||||
stringify_array_elms($recipients);
|
stringify_array_elms($recipients);
|
||||||
if(! $recipients) {
|
if(! $recipients) {
|
||||||
logger('no recipients');
|
logger('no recipients');
|
||||||
|
@ -35,6 +35,9 @@ class Activity {
|
|||||||
if($x['type'] === ACTIVITY_OBJ_EVENT) {
|
if($x['type'] === ACTIVITY_OBJ_EVENT) {
|
||||||
return self::fetch_event($x);
|
return self::fetch_event($x);
|
||||||
}
|
}
|
||||||
|
if($x['type'] === ACTIVITY_OBJ_PHOTO) {
|
||||||
|
return self::fetch_image($x);
|
||||||
|
}
|
||||||
|
|
||||||
return $x;
|
return $x;
|
||||||
|
|
||||||
@ -102,6 +105,29 @@ class Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static function fetch_image($x) {
|
||||||
|
|
||||||
|
|
||||||
|
$ret = [
|
||||||
|
'type' => 'Image',
|
||||||
|
'id' => $x['id'],
|
||||||
|
'name' => $x['title'],
|
||||||
|
'content' => bbcode($x['body']),
|
||||||
|
'source' => [ 'mediaType' => 'text/bbcode', 'content' => $x['body'] ],
|
||||||
|
'published' => datetime_convert('UTC','UTC',$x['created'],ATOM_TIME),
|
||||||
|
'updated' => datetime_convert('UTC','UTC', $x['edited'],ATOM_TIME),
|
||||||
|
'url' => [
|
||||||
|
'type' => 'Link',
|
||||||
|
'mediaType' => $x['link'][0]['type'],
|
||||||
|
'href' => $x['link'][0]['href'],
|
||||||
|
'width' => $x['link'][0]['width'],
|
||||||
|
'height' => $x['link'][0]['height']
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
static function fetch_event($x) {
|
static function fetch_event($x) {
|
||||||
|
|
||||||
// convert old Zot event objects to ActivityStreams Event objects
|
// convert old Zot event objects to ActivityStreams Event objects
|
||||||
@ -389,6 +415,8 @@ class Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ret['type'] = self::activity_mapper($i['verb']);
|
$ret['type'] = self::activity_mapper($i['verb']);
|
||||||
|
|
||||||
|
|
||||||
$ret['id'] = ((strpos($i['mid'],'http') === 0) ? $i['mid'] : z_root() . '/activity/' . urlencode($i['mid']));
|
$ret['id'] = ((strpos($i['mid'],'http') === 0) ? $i['mid'] : z_root() . '/activity/' . urlencode($i['mid']));
|
||||||
|
|
||||||
if($i['title'])
|
if($i['title'])
|
||||||
@ -460,6 +488,10 @@ class Activity {
|
|||||||
if(! is_array($i['obj'])) {
|
if(! is_array($i['obj'])) {
|
||||||
$i['obj'] = json_decode($i['obj'],true);
|
$i['obj'] = json_decode($i['obj'],true);
|
||||||
}
|
}
|
||||||
|
if($i['obj']['type'] === ACTIVITY_OBJ_PHOTO) {
|
||||||
|
$i['obj']['id'] = $i['id'];
|
||||||
|
}
|
||||||
|
|
||||||
$obj = self::encode_object($i['obj']);
|
$obj = self::encode_object($i['obj']);
|
||||||
if($obj)
|
if($obj)
|
||||||
$ret['object'] = $obj;
|
$ret['object'] = $obj;
|
||||||
@ -1609,7 +1641,9 @@ class Activity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($act->obj['type'] === 'Image') {
|
// avoid double images from hubzilla to zap/osada
|
||||||
|
|
||||||
|
if($act->obj['type'] === 'Image' && strpos($s['body'],'zrl=') === false) {
|
||||||
|
|
||||||
$ptr = null;
|
$ptr = null;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user