Commit 85704bfb authored by Yassine Doghri's avatar Yassine Doghri
Browse files

refactor: rename controller methods for views and actions to be more consistent

add PermalinkEditor component
parent 8cf9c6dc
Loading
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ $routes->group('@(:podcastHandle)', static function ($routes): void {
        $routes->get('comments/(:uuid)/replies', 'EpisodeCommentController::replies/$1/$2/$3', [
            'as' => 'episode-comment-replies',
        ]);
        $routes->post('comments/(:uuid)/like', 'EpisodeCommentController::attemptLike/$1/$2/$3', [
        $routes->post('comments/(:uuid)/like', 'EpisodeCommentController::likeAction/$1/$2/$3', [
            'as' => 'episode-comment-attempt-like',
        ]);
        $routes->get('oembed.json', 'EpisodeController::oembedJSON/$1/$2', [
@@ -229,7 +229,7 @@ $routes->get('/pages/(:slug)', 'PageController::index/$1', [
 * Overwriting Fediverse routes file
 */
$routes->group('@(:podcastHandle)', static function ($routes): void {
    $routes->post('posts/new', 'PostController::attemptCreate/$1', [
    $routes->post('posts/new', 'PostController::createAction/$1', [
        'as'     => 'post-attempt-create',
        'filter' => 'permission:podcast$1.manage-publications',
    ]);
@@ -266,13 +266,13 @@ $routes->group('@(:podcastHandle)', static function ($routes): void {
            'filter' => 'allow-cors',
        ]);
        // Actions
        $routes->post('action', 'PostController::attemptAction/$1/$2', [
        $routes->post('action', 'PostController::actionAction/$1/$2', [
            'as'     => 'post-attempt-action',
            'filter' => 'permission:podcast$1.interact-as',
        ]);
        $routes->post(
            'block-actor',
            'PostController::attemptBlockActor/$1/$2',
            'PostController::blockActorAction/$1/$2',
            [
                'as'     => 'post-attempt-block-actor',
                'filter' => 'permission:fediverse.manage-blocks',
@@ -280,13 +280,13 @@ $routes->group('@(:podcastHandle)', static function ($routes): void {
        );
        $routes->post(
            'block-domain',
            'PostController::attemptBlockDomain/$1/$2',
            'PostController::blockDomainAction/$1/$2',
            [
                'as'     => 'post-attempt-block-domain',
                'filter' => 'permission:fediverse.manage-blocks',
            ],
        );
        $routes->post('delete', 'PostController::attemptDelete/$1/$2', [
        $routes->post('delete', 'PostController::deleteAction/$1/$2', [
            'as'     => 'post-attempt-delete',
            'filter' => 'permission:podcast$1.manage-publications',
        ]);
+3 −6
Original line number Diff line number Diff line
@@ -22,13 +22,10 @@ class ActorController extends FediverseActorController
     */
    protected $helpers = ['svg', 'components', 'misc', 'seo'];

    public function follow(): string
    public function followView(): string
    {
        // Prevent analytics hit when authenticated
        if (! auth()->loggedIn()) {
        // @phpstan-ignore-next-line
        $this->registerPodcastWebpageHit($this->actor->podcast->id);
        }

        helper(['form', 'components', 'svg']);
        // @phpstan-ignore-next-line
+0 −16
Original line number Diff line number Diff line
@@ -5,9 +5,7 @@ declare(strict_types=1);
namespace App\Controllers;

use CodeIgniter\Controller;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
use Override;
use Psr\Log\LoggerInterface;
@@ -21,20 +19,6 @@ use ViewThemes\Theme;
 */
abstract class BaseController extends Controller
{
    /**
     * Instance of the main Request object.
     *
     * @var IncomingRequest
     */
    protected $request;

    /**
     * Instance of the main response object.
     *
     * @var Response
     */
    protected $response;

    /**
     * An array of helpers to be loaded automatically upon
     * class instantiation. These helpers will be available
+2 −9
Original line number Diff line number Diff line
@@ -11,18 +11,11 @@ declare(strict_types=1);
namespace App\Controllers;

use CodeIgniter\Controller;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;

class ColorsController extends Controller
{
    /**
     * Instance of the main response object.
     *
     * @var Response
     */
    protected $response;

    public function index(): Response
    public function index(): ResponseInterface
    {
        $cacheName = 'colors.css';
        if (
+0 −8
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ use App\Models\EpisodeModel;
use App\Models\PodcastModel;
use CodeIgniter\Controller;
use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@@ -30,13 +29,6 @@ use Psr\Log\LoggerInterface;

class EpisodeAudioController extends Controller
{
    /**
     * Instance of the main Request object.
     *
     * @var IncomingRequest
     */
    protected $request;

    /**
     * An array of helpers to be loaded automatically upon class instantiation. These helpers will be available to all
     * other controllers that extend Analytics.
Loading