aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDM42.Net Zap Dev <zapdev@dm42.net>2019-09-21 13:37:20 -0400
committerDM42.Net Zap Dev <zapdev@dm42.net>2019-09-21 13:37:20 -0400
commitc63fb0fc6b7b1b779d37821bff5fbaa8fbbfdf5a (patch)
tree8f284d9f8dc68dabc23a3edee1ed1eebebfb6b83
parent6fe4ac241d0dc7710be496a215fc96741856f38a (diff)
downloadvolse-hubzilla-c63fb0fc6b7b1b779d37821bff5fbaa8fbbfdf5a.tar.gz
volse-hubzilla-c63fb0fc6b7b1b779d37821bff5fbaa8fbbfdf5a.tar.bz2
volse-hubzilla-c63fb0fc6b7b1b779d37821bff5fbaa8fbbfdf5a.zip
comment policy default for ordered items
-rw-r--r--Zotlabs/Lib/Libzot.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index c03749d33..0c90ff34d 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1849,6 +1849,10 @@ class Libzot {
$ret = [];
+ $signer = q("select hubloc_hash, hubloc_url from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
+ dbesc($a['signature']['signer'])
+ );
+
foreach($a['data']['orderedItems'] as $activity) {
$AS = new ActivityStreams($activity);
@@ -1907,6 +1911,23 @@ class Libzot {
if($AS->data['hubloc']) {
$arr['item_verified'] = true;
}
+
+ // 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
+
+ if ($signer) {
+ $s = q("select site_project from site where site_url = '%s' limit 1",
+ dbesc($signer[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']) {
IConfig::Set($arr,'activitystreams','signed_data',$AS->data['signed_data'],false);
}