Commit 90e44437 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix: remove cache from remote follow form to display error messages

parent 4a009de5
Loading
Loading
Loading
Loading
Loading
+7 −15
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@ class ActorController extends FediverseActorController
            $this->registerPodcastWebpageHit($this->actor->podcast->id);
        }

        $cacheName = "page_podcast-{$this->actor->username}_follow";
        if (! ($cachedView = cache($cacheName))) {
        helper(['form', 'components', 'svg']);
        $data = [
            // @phpstan-ignore-next-line
@@ -39,12 +37,6 @@ class ActorController extends FediverseActorController
            'actor' => $this->actor,
        ];

            return view('podcast/follow', $data, [
                'cache' => DECADE,
                'cache_name' => $cacheName,
            ]);
        }

        return $cachedView;
        return view('podcast/follow', $data);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ return [
        'title' => 'Follow {actorDisplayName}',
        'subtitle' => 'You are going to follow:',
        'accountNotFound' => 'The account could not be found.',
        'remoteFollowNotAllowed' => 'Seems like the account server does not allow remote follows…',
        'submit' => 'Proceed to follow',
    ],
    'favourite' => [
+5 −4
Original line number Diff line number Diff line
@@ -15,23 +15,24 @@ return [
    'follow' => [
        'label' => 'Suivre',
        'title' => 'Suivre {actorDisplayName}',
        'subtitle' => 'Vous allez suivre :',
        'subtitle' => 'Vous allez suivre :',
        'accountNotFound' => 'Le compte n’a pas pu être trouvé.',
        'remoteFollowNotAllowed' => 'Il semble que le serveur du compte ne permet pas le suivi d’un compte externe…',
        'submit' => 'Poursuivre',
    ],
    'favourite' => [
        'title' => 'Mettez la publication de {actorDisplayName} en favori',
        'subtitle' => 'Vous allez mettre en favori :',
        'subtitle' => 'Vous allez mettre en favori :',
        'submit' => 'Poursuivre',
    ],
    'reblog' => [
        'title' => 'Partagez la publication de {actorDisplayName}',
        'subtitle' => 'Vous allez partager :',
        'subtitle' => 'Vous allez partager :',
        'submit' => 'Poursuivre',
    ],
    'reply' => [
        'title' => 'Répondre à la publication de {actorDisplayName}',
        'subtitle' => 'Vous allez répondre à :',
        'subtitle' => 'Vous allez répondre à :',
        'submit' => 'Poursuivre',
    ],
];
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ return [
        'title' => 'Obserwuj {actorDisplayName}',
        'subtitle' => 'Zamierzasz obserwować:',
        'accountNotFound' => 'Nie można znaleźć konta.',
        'remoteFollowNotAllowed' => 'Seems like the account server does not allow remote follows…',
        'submit' => 'Przejdź do obserwowania',
    ],
    'favourite' => [
+11 −5
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\I18n\Time;
use Exception;
use Modules\Fediverse\Config\Fediverse;
use Modules\Fediverse\Entities\Actor;
use Modules\Fediverse\Entities\Post;
@@ -353,10 +354,12 @@ class ActorController extends Controller
        // parse actor id to get actor and domain
        // check if actor and domain exist

        if (
            ! ($parts = split_handle($this->request->getPost('handle'))) ||
            ! ($data = get_webfinger_data($parts['username'], $parts['domain']))
        ) {
        $handle = $this->request->getPost('handle');
        $parts = split_handle($handle);

        try {
            $data = get_webfinger_data($parts['username'], $parts['domain']);
        } catch (Exception) {
            return redirect()
                ->back()
                ->withInput()
@@ -372,7 +375,10 @@ class ActorController extends Controller
        if (! $ostatusKey) {
            // TODO: error, couldn't subscribe to activitypub account
            // The instance doesn't allow its users to follow others
            return $this->response->setJSON([]);
            return redirect()
                ->back()
                ->withInput()
                ->with('error', lang('Fediverse.follow.remoteFollowNotAllowed'));
        }

        return redirect()->to(
Loading