2021-04-02 17:20:02 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @copyright 2020 Podlibre
|
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Controllers;
|
|
|
|
|
2021-04-22 17:20:28 +00:00
|
|
|
use Analytics\AnalyticsTrait;
|
|
|
|
|
2021-04-02 17:20:02 +00:00
|
|
|
class Actor extends \ActivityPub\Controllers\ActorController
|
|
|
|
{
|
2021-04-22 17:20:28 +00:00
|
|
|
use AnalyticsTrait;
|
|
|
|
|
2021-05-12 10:22:16 +00:00
|
|
|
protected $helpers = ['auth', 'svg', 'components', 'misc'];
|
|
|
|
|
2021-04-02 17:20:02 +00:00
|
|
|
public function follow()
|
|
|
|
{
|
2021-04-22 17:20:28 +00:00
|
|
|
// Prevent analytics hit when authenticated
|
|
|
|
if (!can_user_interact()) {
|
|
|
|
$this->registerPodcastWebpageHit($this->actor->podcast->id);
|
|
|
|
}
|
|
|
|
|
2021-05-06 14:00:48 +00:00
|
|
|
$cacheName = "page_podcast-{$this->actor->username}_follow";
|
2021-04-22 17:20:28 +00:00
|
|
|
if (!($cachedView = cache($cacheName))) {
|
|
|
|
helper(['form', 'components', 'svg']);
|
|
|
|
$data = [
|
|
|
|
'actor' => $this->actor,
|
|
|
|
];
|
|
|
|
|
|
|
|
return view('podcast/follow', $data, [
|
|
|
|
'cache' => DECADE,
|
|
|
|
'cache_name' => $cacheName,
|
|
|
|
]);
|
|
|
|
}
|
2021-04-02 17:20:02 +00:00
|
|
|
|
2021-04-22 17:20:28 +00:00
|
|
|
return $cachedView;
|
2021-04-02 17:20:02 +00:00
|
|
|
}
|
|
|
|
}
|