Commit 2d4bc42f authored by Thomas's avatar Thomas
Browse files

fix an issue with main Mastodon URL

parent 224151b7
......@@ -97,7 +97,8 @@ class CollectMastodonData {
if (isset($searchResult['html']['statuses'])) {
foreach ($searchResult['html']['statuses'] as $status) {
if ($status['in_reply_to_id'] === null) {
$result[] = $status['id'];
$result['id'][] = $status['id'];
$result['url'][] = $status['url'];
}
}
}
......
......@@ -744,7 +744,6 @@ class Mastodon_api {
*/
public function search ($parameters) {
$response = $this->_get('/api/v1/search',$parameters);
return $response;
}
......
......@@ -118,6 +118,11 @@ class Mastalab_comments_Public {
}
/**
* Add a div at the end of the article when defined in settings
*
* @since 1.0.9
*/
public function mastalab_comments_add_to_footer(){
$fullcontent = get_the_content();
if(is_page() || is_single()) {
......@@ -229,7 +234,6 @@ class Mastalab_comments_Public {
*/
public function prefix_ajax_mastalab_comments_getcomment(){
@define('ROOTPATH', __DIR__);
require_once(ROOTPATH.'/../Class/CollectMastodonData.php');
......@@ -272,14 +276,18 @@ class Mastalab_comments_Public {
$needRefresh = true;
}
if ($needRefresh) {
$ids = $collector->findToots($search);
$result['stats']['root'] = isset($ids[0]) ? $ids[0] : 0;
foreach ($ids as $id) {
$data = $collector->findToots($search);
$inc = 0;
foreach ($data['id'] as $id) {
$result['stats']['root'] = $id;
// get comments
$collector->getComments($id, $result);
// get statistics (likes, replies, boosts,...)
$collector->getStatistics($id, $result);
$result['stats']['replies'] = count($result['comments']);
$result['stats']['url'] = $data['url'][$inc];
$inc++;
}
$dateInsert = new DateTime();
//Cache the status
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment