mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-27 20:21:59 +02:00
fix: remove cache from remote follow form to display error messages
This commit is contained in:
parent
4a009de531
commit
90e44437bd
@ -30,21 +30,13 @@ class ActorController extends FediverseActorController
|
|||||||
$this->registerPodcastWebpageHit($this->actor->podcast->id);
|
$this->registerPodcastWebpageHit($this->actor->podcast->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheName = "page_podcast-{$this->actor->username}_follow";
|
helper(['form', 'components', 'svg']);
|
||||||
if (! ($cachedView = cache($cacheName))) {
|
$data = [
|
||||||
helper(['form', 'components', 'svg']);
|
// @phpstan-ignore-next-line
|
||||||
$data = [
|
'metatags' => get_follow_metatags($this->actor),
|
||||||
// @phpstan-ignore-next-line
|
'actor' => $this->actor,
|
||||||
'metatags' => get_follow_metatags($this->actor),
|
];
|
||||||
'actor' => $this->actor,
|
|
||||||
];
|
|
||||||
|
|
||||||
return view('podcast/follow', $data, [
|
return view('podcast/follow', $data);
|
||||||
'cache' => DECADE,
|
|
||||||
'cache_name' => $cacheName,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $cachedView;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ return [
|
|||||||
'title' => 'Follow {actorDisplayName}',
|
'title' => 'Follow {actorDisplayName}',
|
||||||
'subtitle' => 'You are going to follow:',
|
'subtitle' => 'You are going to follow:',
|
||||||
'accountNotFound' => 'The account could not be found.',
|
'accountNotFound' => 'The account could not be found.',
|
||||||
|
'remoteFollowNotAllowed' => 'Seems like the account server does not allow remote follows…',
|
||||||
'submit' => 'Proceed to follow',
|
'submit' => 'Proceed to follow',
|
||||||
],
|
],
|
||||||
'favourite' => [
|
'favourite' => [
|
||||||
|
@ -15,23 +15,24 @@ return [
|
|||||||
'follow' => [
|
'follow' => [
|
||||||
'label' => 'Suivre',
|
'label' => 'Suivre',
|
||||||
'title' => 'Suivre {actorDisplayName}',
|
'title' => 'Suivre {actorDisplayName}',
|
||||||
'subtitle' => 'Vous allez suivre :',
|
'subtitle' => 'Vous allez suivre :',
|
||||||
'accountNotFound' => 'Le compte n’a pas pu être trouvé.',
|
'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',
|
'submit' => 'Poursuivre',
|
||||||
],
|
],
|
||||||
'favourite' => [
|
'favourite' => [
|
||||||
'title' => 'Mettez la publication de {actorDisplayName} en favori',
|
'title' => 'Mettez la publication de {actorDisplayName} en favori',
|
||||||
'subtitle' => 'Vous allez mettre en favori :',
|
'subtitle' => 'Vous allez mettre en favori :',
|
||||||
'submit' => 'Poursuivre',
|
'submit' => 'Poursuivre',
|
||||||
],
|
],
|
||||||
'reblog' => [
|
'reblog' => [
|
||||||
'title' => 'Partagez la publication de {actorDisplayName}',
|
'title' => 'Partagez la publication de {actorDisplayName}',
|
||||||
'subtitle' => 'Vous allez partager :',
|
'subtitle' => 'Vous allez partager :',
|
||||||
'submit' => 'Poursuivre',
|
'submit' => 'Poursuivre',
|
||||||
],
|
],
|
||||||
'reply' => [
|
'reply' => [
|
||||||
'title' => 'Répondre à la publication de {actorDisplayName}',
|
'title' => 'Répondre à la publication de {actorDisplayName}',
|
||||||
'subtitle' => 'Vous allez répondre à :',
|
'subtitle' => 'Vous allez répondre à :',
|
||||||
'submit' => 'Poursuivre',
|
'submit' => 'Poursuivre',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -16,6 +16,7 @@ return [
|
|||||||
'title' => 'Obserwuj {actorDisplayName}',
|
'title' => 'Obserwuj {actorDisplayName}',
|
||||||
'subtitle' => 'Zamierzasz obserwować:',
|
'subtitle' => 'Zamierzasz obserwować:',
|
||||||
'accountNotFound' => 'Nie można znaleźć konta.',
|
'accountNotFound' => 'Nie można znaleźć konta.',
|
||||||
|
'remoteFollowNotAllowed' => 'Seems like the account server does not allow remote follows…',
|
||||||
'submit' => 'Przejdź do obserwowania',
|
'submit' => 'Przejdź do obserwowania',
|
||||||
],
|
],
|
||||||
'favourite' => [
|
'favourite' => [
|
||||||
|
@ -15,6 +15,7 @@ use CodeIgniter\Exceptions\PageNotFoundException;
|
|||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use CodeIgniter\I18n\Time;
|
use CodeIgniter\I18n\Time;
|
||||||
|
use Exception;
|
||||||
use Modules\Fediverse\Config\Fediverse;
|
use Modules\Fediverse\Config\Fediverse;
|
||||||
use Modules\Fediverse\Entities\Actor;
|
use Modules\Fediverse\Entities\Actor;
|
||||||
use Modules\Fediverse\Entities\Post;
|
use Modules\Fediverse\Entities\Post;
|
||||||
@ -353,10 +354,12 @@ class ActorController extends Controller
|
|||||||
// parse actor id to get actor and domain
|
// parse actor id to get actor and domain
|
||||||
// check if actor and domain exist
|
// check if actor and domain exist
|
||||||
|
|
||||||
if (
|
$handle = $this->request->getPost('handle');
|
||||||
! ($parts = split_handle($this->request->getPost('handle'))) ||
|
$parts = split_handle($handle);
|
||||||
! ($data = get_webfinger_data($parts['username'], $parts['domain']))
|
|
||||||
) {
|
try {
|
||||||
|
$data = get_webfinger_data($parts['username'], $parts['domain']);
|
||||||
|
} catch (Exception) {
|
||||||
return redirect()
|
return redirect()
|
||||||
->back()
|
->back()
|
||||||
->withInput()
|
->withInput()
|
||||||
@ -372,7 +375,10 @@ class ActorController extends Controller
|
|||||||
if (! $ostatusKey) {
|
if (! $ostatusKey) {
|
||||||
// TODO: error, couldn't subscribe to activitypub account
|
// TODO: error, couldn't subscribe to activitypub account
|
||||||
// The instance doesn't allow its users to follow others
|
// 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(
|
return redirect()->to(
|
||||||
|
19
themes/cp_app/_message_block.php
Normal file
19
themes/cp_app/_message_block.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
if (session()->has('message')): ?>
|
||||||
|
<Alert variant="success" class="mb-4"><?= esc(session('message')) ?></Alert>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (session()->has('error')): ?>
|
||||||
|
<Alert variant="danger" class="mb-4"><?= esc(session('error')) ?></Alert>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (session()->has('errors')): ?>
|
||||||
|
<Alert variant="danger" class="mb-4">
|
||||||
|
<ul>
|
||||||
|
<?php foreach (session('errors') as $error): ?>
|
||||||
|
<li><?= esc($error) ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</Alert>
|
||||||
|
<?php endif; ?>
|
Loading…
Reference in New Issue
Block a user