]> git.mxchange.org Git - friendica.git/commitdiff
Commenting to (nearly) every Friendica contact is now possible
authorMichael <heluecht@pirati.ca>
Thu, 4 Jan 2018 19:48:56 +0000 (19:48 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 4 Jan 2018 19:48:56 +0000 (19:48 +0000)
include/conversation.php
mod/item.php
src/Protocol/Diaspora.php
src/Worker/Delivery.php

index 97630a65fb22633307b1397010bbce8310aded9d..0a565c68e343adb27cf23387aa05774e8d40a259 100644 (file)
@@ -624,7 +624,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
                                $community_readonly = false;
                                $writable = true;
                        } 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 {
                        $writable = false;
@@ -929,6 +929,7 @@ function community_add_items($parents) {
                );
                $comments = dba::inArray($thread_items);
 
+
                if (count($comments) == 0) {
                        $thread_items = dba::p(item_query()." AND `item`.`uid` = 0
                                AND `item`.`parent-uri` = ?
@@ -945,7 +946,7 @@ function community_add_items($parents) {
 
        foreach ($items as $index => $item) {
                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]);
                }
        }
 
index 1faef960163c7845bad16b15a814d58a747dd667..450aac5f2e132602188ad250a662e13a7cdb2225 100644 (file)
@@ -209,7 +209,7 @@ function item_post(App $a) {
        }
 
        // 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
index 59ca2757f367ddfae9235bd954f11060304454a1..6b5f5d5769aa0d4421e67f1d79525effab1a8d56 100644 (file)
@@ -3114,7 +3114,15 @@ class Diaspora
                }
 
                $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) {
                        logger("no url for contact: ".$contact["id"]." batch mode =".$public_batch);
                        return 0;
index 192c5e815dd2aebd4e805fb599bb89bb750eee7a..fc7f884f6ab6fa9b8bd36cb942704864511b4773 100644 (file)
@@ -217,9 +217,14 @@ class Delivery {
                }
                $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']);
 
-               switch($contact['network']) {
+               switch ($contact['network']) {
 
                        case NETWORK_DFRN:
                                logger('notifier: '.$target_item["guid"].' dfrndelivery: '.$contact['name']);