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