[COMPONENT][FreeNetwork] Restore Galaxy feed
This commit is contained in:
parent
f40eb3955f
commit
1056bc661f
|
@ -68,8 +68,11 @@ class Collection extends Component
|
|||
{
|
||||
if (str_contains($term, ':')) {
|
||||
$term = explode(':', $term);
|
||||
if (Formatting::startsWith($term[0], 'note-')) {
|
||||
if (Formatting::startsWith($term[0], 'note')) {
|
||||
switch ($term[0]) {
|
||||
case 'notes-all':
|
||||
$note_expr = $eb->neq('note.created', null);
|
||||
break;
|
||||
case 'note-local':
|
||||
$note_expr = $eb->eq('note.is_local', filter_var($term[1], \FILTER_VALIDATE_BOOLEAN));
|
||||
break;
|
||||
|
|
|
@ -14,7 +14,7 @@ class Collection extends Controller
|
|||
public function query(string $query, ?string $locale = null, ?Actor $actor = null)
|
||||
{
|
||||
$actor ??= Common::actor();
|
||||
$locale ??= $actor?->getTopLanguage()?->getLocale() ?? Common::currentLanguage()->getLocale();
|
||||
$locale ??= Common::currentLanguage()->getLocale();
|
||||
return CollectionModule::query($query, $this->int('page') ?? 1, $locale, $actor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,13 +82,13 @@ abstract class Parser
|
|||
if (\is_null($note_res) && \is_null($actor_res)) { // @phpstan-ignore-line
|
||||
throw new ServerException("No one claimed responsibility for a match term: {$term}");
|
||||
}
|
||||
if (!\is_null($note_res) && !empty($note_res)) { // @phpstan-ignore-line
|
||||
if (!empty($note_res)) { // @phpstan-ignore-line
|
||||
if (\is_array($note_res)) {
|
||||
$note_res = $eb->orX(...$note_res);
|
||||
}
|
||||
$note_parts[] = $note_res;
|
||||
}
|
||||
if (!\is_null($actor_res) && !empty($actor_res)) {
|
||||
if (!empty($actor_res)) {
|
||||
if (\is_array($actor_res)) {
|
||||
$actor_res = $eb->orX(...$actor_res);
|
||||
}
|
||||
|
|
|
@ -47,10 +47,7 @@ class Feeds extends FeedController
|
|||
*/
|
||||
public function public(Request $request): array
|
||||
{
|
||||
$data = $this->query(
|
||||
query: 'note-local:true',
|
||||
locale: Common::currentLanguage()->getLocale(),
|
||||
);
|
||||
$data = $this->query('note-local:true');
|
||||
return [
|
||||
'_template' => 'collection/notes.html.twig',
|
||||
'page_title' => _m(\is_null(Common::user()) ? 'Feed' : 'Planet'),
|
||||
|
@ -63,13 +60,8 @@ class Feeds extends FeedController
|
|||
*/
|
||||
public function home(Request $request): array
|
||||
{
|
||||
$user = Common::ensureLoggedIn();
|
||||
$actor = $user->getActor();
|
||||
$data = $this->query(
|
||||
query: 'note-from:subscribed-person,subscribed-group,subscribed-organization,subscribed-business',
|
||||
locale: Common::currentLanguage()->getLocale(),
|
||||
actor: $actor,
|
||||
);
|
||||
Common::ensureLoggedIn();
|
||||
$data = $this->query('note-from:subscribed-person,subscribed-group,subscribed-organization,subscribed-business');
|
||||
return [
|
||||
'_template' => 'collection/notes.html.twig',
|
||||
'page_title' => _m('Home'),
|
||||
|
|
|
@ -51,10 +51,7 @@ class Feeds extends FeedController
|
|||
public function network(Request $request): array
|
||||
{
|
||||
Common::ensureLoggedIn();
|
||||
$data = $this->query(
|
||||
query: 'note-local:false',
|
||||
locale: Common::currentLanguage()->getLocale(),
|
||||
);
|
||||
$data = $this->query('note-local:false');
|
||||
return [
|
||||
'_template' => 'collection/notes.html.twig',
|
||||
'page_title' => _m('Meteorites'),
|
||||
|
@ -71,6 +68,7 @@ class Feeds extends FeedController
|
|||
public function clique(Request $request): array
|
||||
{
|
||||
Common::ensureLoggedIn();
|
||||
// TODO: maybe make this a Collection::query
|
||||
$notes = DB::dql(
|
||||
<<<'EOF'
|
||||
SELECT n FROM \App\Entity\Note AS n
|
||||
|
@ -99,10 +97,7 @@ class Feeds extends FeedController
|
|||
public function federated(Request $request): array
|
||||
{
|
||||
Common::ensureLoggedIn();
|
||||
$data = $this->query(
|
||||
query: '',
|
||||
locale: Common::currentLanguage()->getLocale(),
|
||||
);
|
||||
$data = $this->query('notes-all:yeah');
|
||||
return [
|
||||
'_template' => 'collection/notes.html.twig',
|
||||
'page_title' => _m('Galaxy'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user