From 52f8429218ae8a0f8c2ff193728e3b4422985207 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 28 May 2019 16:28:03 -0700 Subject: support 'expires' over Zot6 --- Zotlabs/Lib/Activity.php | 16 ++++++++++++++++ Zotlabs/Module/Apschema.php | 1 + boot.php | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 0843e0a7b..dc3cff1e7 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -294,6 +294,10 @@ class Activity { $ret['published'] = datetime_convert('UTC','UTC',$i['created'],ATOM_TIME); if($i['created'] !== $i['edited']) $ret['updated'] = datetime_convert('UTC','UTC',$i['edited'],ATOM_TIME); + if ($i['expires'] <= NULL_DATE) { + $ret['expires'] = datetime_convert('UTC','UTC',$i['expires'],ATOM_TIME); + } + if($i['app']) { $ret['instrument'] = [ 'type' => 'Service', 'name' => $i['app'] ]; } @@ -1309,6 +1313,12 @@ class Activity { elseif($act->obj['updated']) { $s['edited'] = datetime_convert('UTC','UTC',$act->obj['updated']); } + if ($act->data['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->data['expires']); + } + elseif ($act->obj['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->obj['expires']); + } if(! $s['created']) $s['created'] = datetime_convert(); @@ -1493,6 +1503,12 @@ class Activity { elseif($act->obj['updated']) { $s['edited'] = datetime_convert('UTC','UTC',$act->obj['updated']); } + if ($act->data['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->data['expires']); + } + elseif ($act->obj['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->obj['expires']); + } if(in_array($act->type, [ 'Like', 'Dislike', 'Flag', 'Block', 'Announce', 'Accept', 'Reject', 'TentativeAccept', 'emojiReaction' ])) { diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index 5b249bfe8..d217041f2 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -27,6 +27,7 @@ class Apschema extends \Zotlabs\Web\Controller { 'nomadicLocation' => 'zot:nomadicLocation', 'nomadicHubs' => 'zot:nomadicHubs', 'emojiReaction' => 'zot:emojiReaction', + 'expires' => 'zot:expires', 'magicEnv' => [ '@id' => 'zot:magicEnv', diff --git a/boot.php b/boot.php index e76440e10..86c3c3272 100755 --- a/boot.php +++ b/boot.php @@ -468,7 +468,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' ); define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' ); -define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.4' ); +define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.5' ); /** * activity stream defines */ -- cgit v1.2.3