mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-28 23:13:17 +00:00
appnet, statusnet: Posts from unknown contacts weren't posted
This commit is contained in:
parent
6e298f7e63
commit
f0efa3cae2
2 changed files with 16 additions and 10 deletions
|
@ -825,13 +825,15 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
|
||||||
if (isset($post["reply_to"]) AND ($post["reply_to"] != "")) {
|
if (isset($post["reply_to"]) AND ($post["reply_to"] != "")) {
|
||||||
$postarray['thr-parent'] = "adn::".$post["reply_to"];
|
$postarray['thr-parent'] = "adn::".$post["reply_to"];
|
||||||
|
|
||||||
// Complete the thread if the parent doesn't exists
|
// Complete the thread (if the parent doesn't exists)
|
||||||
if ($threadcompletion) {
|
if ($threadcompletion) {
|
||||||
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
//$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($postarray['thr-parent']),
|
// dbesc($postarray['thr-parent']),
|
||||||
intval($uid)
|
// intval($uid)
|
||||||
);
|
// );
|
||||||
if (!count($r)) {
|
//if (!count($r)) {
|
||||||
|
logger("appnet_createpost: completing thread ".$post["thread_id"]." for user ".$uid, LOGGER_DEBUG);
|
||||||
|
|
||||||
require_once("addon/appnet/AppDotNet.php");
|
require_once("addon/appnet/AppDotNet.php");
|
||||||
|
|
||||||
$token = get_pconfig($uid,'appnet','token');
|
$token = get_pconfig($uid,'appnet','token');
|
||||||
|
@ -850,11 +852,15 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
|
||||||
logger("appnet_createpost: Error fetching thread for user ".$uid." ".appnet_error($e->getMessage()));
|
logger("appnet_createpost: Error fetching thread for user ".$uid." ".appnet_error($e->getMessage()));
|
||||||
}
|
}
|
||||||
$thread = array_reverse($thread);
|
$thread = array_reverse($thread);
|
||||||
|
|
||||||
|
logger("appnet_createpost: fetched ".count($thread)." items for thread ".$post["thread_id"]." for user ".$uid, LOGGER_DEBUG);
|
||||||
|
|
||||||
foreach ($thread AS $tpost) {
|
foreach ($thread AS $tpost) {
|
||||||
$threadpost = appnet_createpost($a, $uid, $tpost, $me, $user, $ownid, false, false);
|
$threadpost = appnet_createpost($a, $uid, $tpost, $me, $user, $ownid, false, false);
|
||||||
$item = item_store($threadpost);
|
$item = item_store($threadpost);
|
||||||
|
logger("appnet_createpost: stored post ".$post["id"]." thread ".$post["thread_id"]." in item ".$item, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
// Don't create accounts of people who just comment something
|
// Don't create accounts of people who just comment something
|
||||||
$createuser = false;
|
$createuser = false;
|
||||||
|
@ -1042,10 +1048,10 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
|
||||||
intval($uid), dbesc("adn::".$contact["id"]));
|
intval($uid), dbesc("adn::".$contact["id"]));
|
||||||
|
|
||||||
if(!count($r) AND !$create_user)
|
if(!count($r) AND !$create_user)
|
||||||
return($me);
|
return($me["id"]);
|
||||||
|
|
||||||
if ($contact["canonical_url"] == "")
|
if ($contact["canonical_url"] == "")
|
||||||
return($me);
|
return($me["id"]);
|
||||||
|
|
||||||
if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) {
|
if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) {
|
||||||
logger("appnet_fetchcontact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
|
logger("appnet_fetchcontact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
|
||||||
|
|
|
@ -1394,7 +1394,7 @@ function statusnet_complete_conversation($a, $uid, $self, $create_user, $nick, $
|
||||||
$posts = array_reverse($items);
|
$posts = array_reverse($items);
|
||||||
|
|
||||||
foreach($posts AS $post) {
|
foreach($posts AS $post) {
|
||||||
$postarray = statusnet_createpost($a, $uid, $post, $self, $create_user, true);
|
$postarray = statusnet_createpost($a, $uid, $post, $self, false, false);
|
||||||
|
|
||||||
if (trim($postarray['body']) == "")
|
if (trim($postarray['body']) == "")
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue