Merge pull request #9374 from annando/issue-9358-b
Issue-9358 (now for real) commenting and updating on contact now work
This commit is contained in:
commit
fe040dfe4c
|
@ -452,8 +452,8 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
|
||||||
$profile_owner = 0;
|
$profile_owner = 0;
|
||||||
|
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
$live_update_div = '<div id="live-contacts"></div>' . "\r\n"
|
$live_update_div = '<div id="live-contact"></div>' . "\r\n"
|
||||||
. "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 9)
|
. "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 8)
|
||||||
."/?f='; </script>\r\n";
|
."/?f='; </script>\r\n";
|
||||||
}
|
}
|
||||||
} elseif ($mode === 'search') {
|
} elseif ($mode === 'search') {
|
||||||
|
|
|
@ -28,11 +28,10 @@ use Friendica\Module\Contact;
|
||||||
|
|
||||||
function update_contact_content(App $a)
|
function update_contact_content(App $a)
|
||||||
{
|
{
|
||||||
if (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update')) {
|
if (!empty($a->argv[1]) && (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update'))) {
|
||||||
$text = Contact::content([], true);
|
$text = Contact::getConversationsHMTL($a, $a->argv[1], true, ($_GET['item'] ?? 0));
|
||||||
} else {
|
} else {
|
||||||
$text = '';
|
$text = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
System::htmlUpdateExit($text);
|
System::htmlUpdateExit($text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1247,25 +1247,27 @@ class Contact
|
||||||
*
|
*
|
||||||
* @param string $contact_url Contact URL
|
* @param string $contact_url Contact URL
|
||||||
* @param bool $thread_mode
|
* @param bool $thread_mode
|
||||||
* @param int $update
|
* @param int $update Update mode
|
||||||
|
* @param int $parent Item parent ID for the update mode
|
||||||
* @return string posts in HTML
|
* @return string posts in HTML
|
||||||
* @throws \Exception
|
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns posts from a given contact id
|
* Returns posts from a given contact id
|
||||||
*
|
*
|
||||||
* @param integer $cid
|
* @param int $cid Contact ID
|
||||||
* @param bool $thread_mode
|
* @param bool $thread_mode
|
||||||
* @param integer $update
|
* @param int $update Update mode
|
||||||
|
* @param int $parent Item parent ID for the update mode
|
||||||
* @return string posts in HTML
|
* @return string posts in HTML
|
||||||
* @throws \Exception
|
* @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();
|
$a = DI::app();
|
||||||
|
|
||||||
|
@ -1290,10 +1292,14 @@ class Contact
|
||||||
$cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
|
$cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($parent)) {
|
||||||
|
$condition = DBA::mergeConditions($condition, ['parent' => $parent]);
|
||||||
|
} else {
|
||||||
$last_received = isset($_GET['last_received']) ? DateTimeFormat::utc($_GET['last_received']) : '';
|
$last_received = isset($_GET['last_received']) ? DateTimeFormat::utc($_GET['last_received']) : '';
|
||||||
if (!empty($last_received)) {
|
if (!empty($last_received)) {
|
||||||
$condition = DBA::mergeConditions($condition, ["`received` < ?", $last_received]);
|
$condition = DBA::mergeConditions($condition, ["`received` < ?", $last_received]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DI::mode()->isMobile()) {
|
if (DI::mode()->isMobile()) {
|
||||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||||
|
@ -1335,7 +1341,7 @@ class Contact
|
||||||
|
|
||||||
$items = Item::inArray($r);
|
$items = Item::inArray($r);
|
||||||
|
|
||||||
$o .= conversation($a, $items, 'contact-posts', false);
|
$o .= conversation($a, $items, 'contact-posts', $update);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
|
|
|
@ -921,7 +921,7 @@ class Contact extends BaseModule
|
||||||
return $tab_str;
|
return $tab_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getConversationsHMTL($a, $contact_id, $update)
|
public static function getConversationsHMTL($a, $contact_id, $update, $parent = 0)
|
||||||
{
|
{
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
|
@ -952,14 +952,15 @@ class Contact extends BaseModule
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
DI::page()['aside'] = '';
|
DI::page()['aside'] = '';
|
||||||
|
|
||||||
|
if (!$update) {
|
||||||
$profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
|
$profiledata = Model\Contact::getByURLForUser($contact['url'], local_user());
|
||||||
|
|
||||||
Model\Profile::load($a, '', $profiledata, true);
|
Model\Profile::load($a, '', $profiledata, true);
|
||||||
|
}
|
||||||
|
|
||||||
if ($contact['uid'] == 0) {
|
if ($contact['uid'] == 0) {
|
||||||
$o .= Model\Contact::getPostsFromId($contact['id'], true, $update);
|
$o .= Model\Contact::getPostsFromId($contact['id'], true, $update, $parent);
|
||||||
} else {
|
} else {
|
||||||
$o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update);
|
$o .= Model\Contact::getPostsFromUrl($contact['url'], true, $update, $parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue