[NETWORK][TreeNotes] Add TreeNotes plugin which takes over the responsibility of displaying a conversation as a tree, in order to reduce the number of queries

This commit is contained in:
2021-02-18 22:29:55 +00:00
parent 5c53889739
commit fc015c6fdf
4 changed files with 66 additions and 10 deletions

View File

@@ -35,10 +35,11 @@ namespace App\Controller;
use App\Core\Controller;
use App\Core\DB\DB;
use function App\Core\I18n\_m;
use App\Core\Event;
use App\Core\NoteScope;
use App\Util\Common;
use App\Util\Exception\ClientException;
use function App\Core\I18n\_m;
use Symfony\Component\HttpFoundation\Request;
class Network extends Controller
@@ -51,12 +52,16 @@ class Network extends Controller
public function public(Request $request)
{
$notes = DB::sql('select * from note n ' .
"where (n.scope & {$this->instance_scope}) <> 0 " .
'order by n.created DESC',
['n' => 'App\Entity\Note']);
Event::handle('FormatNoteList', [&$notes]);
return [
'_template' => 'network/public.html.twig',
'notes' => DB::sql('select * from note n ' .
"where n.reply_to is null and (n.scope & {$this->instance_scope}) <> 0 " .
'order by n.created DESC',
['n' => 'App\Entity\Note']),
'notes' => $notes,
];
}