forked from GNUsocial/gnu-social
[COMPONENT][Search] Ensure title is set when saving as feed
This commit is contained in:
parent
59380ed2ac
commit
7678e155d9
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user