Commit 00398e5d authored by Mario's avatar Mario
Browse files

Merge branch 'dev'

parents 5828d58d d5d6199c
......@@ -74,7 +74,7 @@ class Diaspora extends Controller {
$sc = '<div class="section-content-info-wrapper">' . $desc . '</div>';
$sc .= replace_macros(get_markup_template('field_checkbox.tpl'), [
'$field' => ['dspr_pubcomment', t('Allow any Diaspora member to comment or like your public posts'), $pubcomments, '', $yes_no],
'$field' => ['dspr_pubcomment', t('Allow any Diaspora member to comment or like your public posts'), $pubcomments, t('If this setting is disabled only your contacts will be able to comment or like your public posts'), $yes_no],
]);
$sc .= replace_macros(get_markup_template('field_checkbox.tpl'), [
......
......@@ -758,6 +758,7 @@ class Diaspora_Receiver {
// does the parent originate from this site?
$local_parent_item = (strpos($parent_item['plink'], z_root()) === 0);
$parent_owner_uid = null;
if ($local_parent_item) {
// find the owner channel_id
......@@ -1023,11 +1024,13 @@ class Diaspora_Receiver {
// let the plugin setting (Allow any Diaspora member to comment on your public posts)
// over-ride possibly more loose channel permission limits (anyone on the internet).
if ($allowed && !$pub_comment && !$abook_contact)
if (!$pub_comment && !$abook_contact)
$allowed = false;
}
else {
$allowed = true;
if (!$pub_comment && !$abook_contact)
$allowed = false;
}
if (!$allowed && !$tgroup) {
......@@ -1542,11 +1545,13 @@ class Diaspora_Receiver {
// let the plugin setting (Allow any Diaspora member to comment/like your public posts)
// over-ride possibly more loose channel permission limits (anyone on the internet).
if ($allowed && !$pub_comment && !$abook_contact)
if (!$pub_comment && !$abook_contact)
$allowed = false;
}
else {
$allowed = true;
if (!$pub_comment && !$abook_contact)
$allowed = false;
}
if (!$allowed) {
......
......@@ -58,7 +58,7 @@ function find_diaspora_person_by_handle($handle) {
if(diaspora_is_blacklisted($handle))
return false;
$r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' and xchan_network != 'activitypub'",
$r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where xchan_addr = '%s' and xchan_network != 'activitypub'",
dbesc($handle)
);
......
......@@ -180,7 +180,7 @@ function photocache_hash($str, $alg = 'sha256') {
if(! $ph->save($r, true))
logger('can not create new link in database', LOGGER_DEBUG);
}
$s['body'] = str_replace($match[3], z_root() . '/photo/' . $resid . '-' . ($cache['item']['imgscale'] ? $cache['item']['imgscale'] : 0), $s['body']);
$s['body'] = str_replace($match[3], z_root() . '/photo/' . $resid, $s['body']);
logger('local resource id ' . $resid . '; xchan: ' . $hash . '; url: ' . $match[3]);
}
}
......
......@@ -624,7 +624,7 @@ function asencode_activity($i) {
// poll answers should be addressed only to the poll owner
if($i['item_private'] && $i['obj_type'] === 'Answer') {
$ret['to'] = $i['owner']['xchan_url'];
$ret['to'][] = $i['owner']['xchan_url'];
$ret['cc'] = [];
}
......@@ -803,6 +803,7 @@ function activity_mapper($verb) {
'http://activitystrea.ms/schema/1.0/tag' => 'Add',
'http://activitystrea.ms/schema/1.0/follow' => 'Follow',
'http://activitystrea.ms/schema/1.0/unfollow' => 'Unfollow',
'http://activitystrea.ms/schema/1.0/stop-following' => 'Unfollow',
'http://purl.org/zot/activity/attendyes' => 'Accept',
'http://purl.org/zot/activity/attendno' => 'Reject',
'http://purl.org/zot/activity/attendmaybe' => 'TentativeAccept'
......@@ -1375,6 +1376,15 @@ function as_vid_sort($a,$b) {
function as_create_note($channel,$observer_hash,$act) {
// Within our family of projects, Follow/Unfollow of a thread is an internal activity which should not be transmitted,
// hence if we receive it - ignore or reject it.
// Unfollow is not defined by ActivityStreams, which prefers Undo->Follow.
// This may have to be revisited if AP projects start using Follow for objects other than actors.
if (in_array($act->type, [ 'Follow', 'Unfollow' ])) {
return false;
}
$s = [];
$announce = (($act->type === 'Announce') ? true : false);
......
......@@ -145,7 +145,6 @@ function pubcrawl_federated_transports(&$x) {
$x[] = 'ActivityPub';
}
function pubcrawl_follow_allow(&$b) {
if ($b['xchan']['xchan_network'] !== 'activitypub')
......@@ -249,7 +248,6 @@ function pubcrawl_discover_channel_webfinger(&$b) {
if (is_array($x)) {
$address = EMPTY_STR;
if (array_key_exists('subject', $x) && strpos($x['subject'], 'acct:') === 0)
......@@ -290,7 +288,6 @@ function pubcrawl_discover_channel_webfinger(&$b) {
return;
}
// Now find the actor and see if there is something we can follow
$person_obj = null;
if (in_array($AS->type, ['Application', 'Group', 'Organization', 'Person', 'Service'])) {
$person_obj = $AS->data;
......@@ -298,6 +295,14 @@ function pubcrawl_discover_channel_webfinger(&$b) {
elseif ($AS->obj && (in_array($AS->obj['type'], ['Application', 'Group', 'Organization', 'Person', 'Service']))) {
$person_obj = $AS->obj;
}
elseif (local_channel() && $AS->obj && (in_array($AS->obj['type'], ['Note', 'Article']))) {
// this implements mastodon remote reply functionality
$item = Activity::decode_note($AS);
if ($item) {
Activity::store(App::get_channel(), get_observer_hash(), $AS, $item, true, true);
goaway(z_root() . '/display/' . gen_link_id($item['mid']));
}
}
else {
return;
}
......@@ -1138,11 +1143,6 @@ function pubcrawl_follow_mod_init($x) {
killme();
}
// Deal with mastodon remote reply
// Make sure it is not a real attempt to connect with a profile
if (local_channel() && isset($_REQUEST['url']) && !array_key_exists('submit', $_REQUEST) && !array_key_exists('interactive', $_REQUEST)) {
goaway(z_root() . '/search?search=' . $_REQUEST['url']);
}
}
......
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