Issue-9358 (now for real) commenting and updating on contact now work

This commit is contained in:
Michael 2020-10-06 18:47:23 +00:00
parent c184994660
commit 5998c3995e
4 changed files with 24 additions and 18 deletions

View file

@ -1248,12 +1248,13 @@ class Contact
* @param string $contact_url Contact URL
* @param bool $thread_mode
* @param int $update
* @param int $parent
* @return string posts in HTML
* @throws \Exception
*/
public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0)
public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0, $parent = 0)
{
return self::getPostsFromId(self::getIdForURL($contact_url), $thread_mode, $update);
return self::getPostsFromId(self::getIdForURL($contact_url), $thread_mode, $update, $parent);
}
/**
@ -1262,10 +1263,11 @@ class Contact
* @param integer $cid
* @param bool $thread_mode
* @param integer $update
* @param int $parent
* @return string posts in HTML
* @throws \Exception
*/
public static function getPostsFromId($cid, $thread_mode = false, $update = 0)
public static function getPostsFromId($cid, $thread_mode = false, $update = 0, $parent = 0)
{
$a = DI::app();
@ -1290,9 +1292,13 @@ class Contact
$cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
}
$last_received = isset($_GET['last_received']) ? DateTimeFormat::utc($_GET['last_received']) : '';
if (!empty($last_received)) {
$condition = DBA::mergeConditions($condition, ["`received` < ?", $last_received]);
if (!empty($parent)) {
$condition = DBA::mergeConditions($condition, ['parent' => $parent]);
} else {
$last_received = isset($_GET['last_received']) ? DateTimeFormat::utc($_GET['last_received']) : '';
if (!empty($last_received)) {
$condition = DBA::mergeConditions($condition, ["`received` < ?", $last_received]);
}
}
if (DI::mode()->isMobile()) {
@ -1335,7 +1341,7 @@ class Contact
$items = Item::inArray($r);
$o .= conversation($a, $items, 'contact-posts', false);
$o .= conversation($a, $items, 'contact-posts', $update);
}
if (!$update) {