AOI: Send "history" section for trends
This commit is contained in:
parent
9cd642abbc
commit
e6e90abc77
2 changed files with 8 additions and 4 deletions
|
@ -45,7 +45,8 @@ class Trends extends BaseApi
|
|||
$tags = Tag::getGlobalTrendingHashtags(24, 20);
|
||||
foreach ($tags as $tag) {
|
||||
$tag['name'] = $tag['term'];
|
||||
$hashtag = new \Friendica\Object\Api\Mastodon\Tag(DI::baseUrl(), $tag);
|
||||
$history = [['day' => (string)time(), 'uses' => (string)$tag['score'], 'accounts' => (string)$tag['authors']]];
|
||||
$hashtag = new \Friendica\Object\Api\Mastodon\Tag(DI::baseUrl(), $tag, $history);
|
||||
$trending[] = $hashtag->toArray();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ class Tag extends BaseDataTransferObject
|
|||
protected $name;
|
||||
/** @var string */
|
||||
protected $url = null;
|
||||
/** @var array */
|
||||
protected $history = [];
|
||||
|
||||
/**
|
||||
* Creates a hashtag record from an tag-view record.
|
||||
|
@ -43,9 +45,10 @@ class Tag extends BaseDataTransferObject
|
|||
* @param array $tag tag-view record
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function __construct(BaseURL $baseUrl, array $tag)
|
||||
public function __construct(BaseURL $baseUrl, array $tag, array $history = [])
|
||||
{
|
||||
$this->name = strtolower($tag['name']);
|
||||
$this->url = $baseUrl . '/search?tag=' . urlencode($this->name);
|
||||
$this->name = strtolower($tag['name']);
|
||||
$this->url = $baseUrl . '/search?tag=' . urlencode($this->name);
|
||||
$this->history = $history;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue