[COMPONENT][Search] Ensure title is set when saving as feed

This commit is contained in:
Diogo Peralta Cordeiro 2022-02-21 04:49:08 +00:00
parent 59380ed2ac
commit 7678e155d9
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 6 additions and 2 deletions

View File

@ -25,6 +25,7 @@ namespace Component\Search;
use App\Core\Event;
use App\Core\Form;
use App\Util\Exception\ClientException;
use function App\Core\I18n\_m;
use App\Core\Modules\Component;
use App\Util\Common;
@ -109,8 +110,11 @@ class Search extends Component
/** @var SubmitButton $subscribe */
$subscribe = $form->get('subscribe_to_search');
if ($subscribe->isClicked()) {
// TODO ensure title is set
Event::handle('AppendFeed', [$actor, $data['title'], 'search', ['q' => $data['search_query']]]);
if (!\is_null($data['title'])) {
Event::handle('AppendFeed', [$actor, $data['title'], 'search', ['q' => $data['search_query']]]);
} else {
throw new ClientException(_m('Empty title is not allowed.'));
}
$redirect = true;
}
}