[CORE][TOOL] Minor fixes and run cs-fixer

This commit is contained in:
Hugo Sales 2021-12-26 15:15:00 +00:00 committed by Diogo Peralta Cordeiro
parent 97243151fa
commit 000ec680e6
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
3 changed files with 8 additions and 9 deletions

View File

@ -36,7 +36,6 @@ declare(strict_types = 1);
namespace App\Controller;
use function App\Core\I18n\_m;
use App\Core\VisibilityScope;
use App\Util\Common;
use Component\Feed\Feed;
use Component\Feed\Util\FeedController;
@ -55,9 +54,9 @@ class Feeds extends FeedController
language: Common::actor()?->getTopLanguage()?->getLocale(),
);
return [
'_template' => 'feed/feed.html.twig',
'page_title' => _m(\is_null(Common::user()) ? 'Feed' : 'Planet'),
'notes' => $data['notes'],
'_template' => 'feed/feed.html.twig',
'page_title' => _m(\is_null(Common::user()) ? 'Feed' : 'Planet'),
'notes' => $data['notes'],
];
}
@ -74,9 +73,9 @@ class Feeds extends FeedController
actor: Common::actor(),
);
return [
'_template' => 'feed/feed.html.twig',
'page_title' => _m('Home'),
'notes' => $data['notes'],
'_template' => 'feed/feed.html.twig',
'page_title' => _m('Home'),
'notes' => $data['notes'],
];
}
}

View File

@ -46,7 +46,7 @@ class CoreFixtures extends Fixture
$manager->persist($n);
$notes = [];
$notes[] = Note::create(['actor_id' => $actors['taken_user']->getId(), 'content' => 'some other content', 'content_type' => 'text/plain', 'is_local' => true]);
$notes[] = Note::create(['actor_id' => $actors['taken_user']->getId(), 'content' => 'private note', 'scope' => VisibilityScope::SUBSCRIBER, 'content_type' => 'text/plain', 'is_local' => false]);
$notes[] = Note::create(['actor_id' => $actors['taken_user']->getId(), 'content' => 'private note', 'scope' => VisibilityScope::COLLECTION, 'content_type' => 'text/plain', 'is_local' => false]);
$notes[] = $group_note = Note::create(['actor_id' => $actors['taken_user']->getId(), 'content' => 'group note', 'scope' => VisibilityScope::GROUP, 'content_type' => 'text/plain', 'is_local' => true]);
foreach ($notes as $note) {
$manager->persist($note);

View File

@ -52,7 +52,7 @@ class NoteTest extends GNUsocialTestCase
$actor2 = DB::findOneBy('actor', ['nickname' => 'taken_group']);
$actor3 = DB::findOneBy('actor', ['nickname' => 'some_user']);
$note_visible_to_1 = DB::findBy('note', ['actor_id' => $actor1->getId(), 'content' => 'private note', 'scope' => VisibilityScope::SUBSCRIBER], limit: 1)[0];
$note_visible_to_1 = DB::findBy('note', ['actor_id' => $actor1->getId(), 'content' => 'private note', 'scope' => VisibilityScope::COLLECTION], limit: 1)[0];
static::assertTrue($note_visible_to_1->isVisibleTo($actor1));
static::assertFalse($note_visible_to_1->isVisibleTo($actor2));
static::assertFalse($note_visible_to_1->isVisibleTo($actor3));