encode/decode comment_policy for Z6
This commit is contained in:
parent
c385b80807
commit
6fe4ac241d
@ -339,10 +339,21 @@ class Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (intval($i['item_wall']) && $i['mid'] === $i['parent_mid']) {
|
||||||
|
$ret['commentPolicy'] = map_scope(PermissionLimits::Get($i['uid'],'post_comments'));
|
||||||
|
}
|
||||||
|
|
||||||
if (intval($i['item_private']) === 2) {
|
if (intval($i['item_private']) === 2) {
|
||||||
$ret['directMessage'] = true;
|
$ret['directMessage'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('comments_closed',$i) && $i['comments_closed'] !== EMPTY_STR && $i['comments_closed'] !== NULL_DATE) {
|
||||||
|
if($ret['commentPolicy']) {
|
||||||
|
$ret['commentPolicy'] .= ' ';
|
||||||
|
}
|
||||||
|
$ret['commentPolicy'] .= 'until=' . datetime_convert('UTC','UTC',$i['comments_closed'],ATOM_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
$ret['attributedTo'] = $i['author']['xchan_url'];
|
$ret['attributedTo'] = $i['author']['xchan_url'];
|
||||||
|
|
||||||
if($i['id'] != $i['parent']) {
|
if($i['id'] != $i['parent']) {
|
||||||
|
@ -1223,9 +1223,39 @@ class Libzot {
|
|||||||
if($private) {
|
if($private) {
|
||||||
$arr['item_private'] = true;
|
$arr['item_private'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($arr['mid'] === $arr['parent_mid']) {
|
||||||
|
if (is_array($AS->obj) && array_key_exists('commentPolicy',$AS->obj)) {
|
||||||
|
$p = strstr($AS->obj['commentPolicy'],'until=');
|
||||||
|
if($p !== false) {
|
||||||
|
$arr['comments_closed'] = datetime_convert('UTC','UTC', substr($p,6));
|
||||||
|
$arr['comment_policy'] = trim(str_replace($p,'',$AS->obj['commentPolicy']));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$arr['comment_policy'] = $AS->obj['commentPolicy'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @FIXME - spoofable
|
/// @FIXME - spoofable
|
||||||
if($AS->data['hubloc']) {
|
if($AS->data['hubloc']) {
|
||||||
$arr['item_verified'] = true;
|
$arr['item_verified'] = true;
|
||||||
|
|
||||||
|
if (! array_key_exists('comment_policy',$arr)) {
|
||||||
|
// set comment policy depending on source hub. Unknown or osada is ActivityPub.
|
||||||
|
// Anything else we'll say is zot - which could have a range of project names
|
||||||
|
$s = q("select site_project from site where site_url = '%s' limit 1",
|
||||||
|
dbesc($r[0]['hubloc_url'])
|
||||||
|
);
|
||||||
|
|
||||||
|
if ((! $s) || (in_array($s[0]['site_project'],[ '', 'osada' ]))) {
|
||||||
|
$arr['comment_policy'] = 'authenticated';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$arr['comment_policy'] = 'contacts';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if($AS->data['signed_data']) {
|
if($AS->data['signed_data']) {
|
||||||
IConfig::Set($arr,'activitystreams','signed_data',$AS->data['signed_data'],false);
|
IConfig::Set($arr,'activitystreams','signed_data',$AS->data['signed_data'],false);
|
||||||
|
Reference in New Issue
Block a user