Merge pull request #4168 from annando/comment-dfrn

Commenting to (nearly) every Friendica contact is now possible
This commit is contained in:
Hypolite Petovan 2018-01-04 15:12:07 -05:00 committed by GitHub
commit 58d5d91831
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 5 deletions

View file

@ -618,7 +618,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$community_readonly = false; $community_readonly = false;
$writable = true; $writable = true;
} else { } else {
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA)); $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN));
} }
} else { } else {
$writable = false; $writable = false;
@ -919,6 +919,7 @@ function community_add_items($parents) {
); );
$comments = dba::inArray($thread_items); $comments = dba::inArray($thread_items);
if (count($comments) == 0) { if (count($comments) == 0) {
$thread_items = dba::p(item_query()." AND `item`.`uid` = 0 $thread_items = dba::p(item_query()." AND `item`.`uid` = 0
AND `item`.`parent-uri` = ? AND `item`.`parent-uri` = ?
@ -935,7 +936,7 @@ function community_add_items($parents) {
foreach ($items as $index => $item) { foreach ($items as $index => $item) {
if ($item['uid'] == 0) { if ($item['uid'] == 0) {
$items[$index]['writable'] = in_array($item['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS]); $items[$index]['writable'] = in_array($item['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
} }
} }

View file

@ -209,7 +209,7 @@ function item_post(App $a) {
} }
// Allow commenting if it is an answer to a public post // Allow commenting if it is an answer to a public post
$allow_comment = ($profile_uid == 0) && $parent && in_array($parent_item['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA]); $allow_comment = ($profile_uid == 0) && $parent && in_array($parent_item['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
/* /*
* Now check that it is a page_type of PAGE_BLOG, and that valid personal details * Now check that it is a page_type of PAGE_BLOG, and that valid personal details

View file

@ -3114,7 +3114,15 @@ class Diaspora
} }
$logid = random_string(4); $logid = random_string(4);
$dest_url = (($public_batch) ? $contact["batch"] : $contact["notify"]); $dest_url = ($public_batch ? $contact["batch"] : $contact["notify"]);
// Fetch the fcontact entry when there is missing data
// Will possibly happen when data is transmitted to a DFRN contact
if (empty($dest_url) && !empty($contact['addr'])) {
$fcontact = self::personByHandle($contact['addr']);
$dest_url = ($public_batch ? $fcontact["batch"] : $fcontact["notify"]);
}
if (!$dest_url) { if (!$dest_url) {
logger("no url for contact: ".$contact["id"]." batch mode =".$public_batch); logger("no url for contact: ".$contact["id"]." batch mode =".$public_batch);
return 0; return 0;

View file

@ -217,6 +217,11 @@ class Delivery {
} }
$deliver_status = 0; $deliver_status = 0;
// Transmit via Diaspora if not possible via Friendica
if (($item['uid'] == 0) && ($contact['network'] == NETWORK_DFRN)) {
$contact['network'] = NETWORK_DIASPORA;
}
logger("main delivery by delivery: followup=$followup mail=$mail fsuggest=$fsuggest relocate=$relocate - network ".$contact['network']); logger("main delivery by delivery: followup=$followup mail=$mail fsuggest=$fsuggest relocate=$relocate - network ".$contact['network']);
switch ($contact['network']) { switch ($contact['network']) {