[DOC] Add documentation to methods flagged by doc-check

This commit is contained in:
Hugo Sales 2021-12-24 09:34:13 +00:00
parent dabf5576d3
commit 1947e99430
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
4 changed files with 26 additions and 3 deletions

View File

@ -36,6 +36,12 @@ use Doctrine\ORM\QueryBuilder;
class Feed extends Component class Feed extends Component
{ {
/**
* Perform a high level query on notes or actors
*
* Supports a variety of query terms and is used both in feeds and
* in search. Uses query builders to allow for extension
*/
public static function query(string $query, int $page, ?string $language = null, ?Actor $actor = null): array public static function query(string $query, int $page, ?string $language = null, ?Actor $actor = null): array
{ {
$note_criteria = null; $note_criteria = null;

View File

@ -44,6 +44,9 @@ class Group extends Component
return Event::next; return Event::next;
} }
/**
* Add an <a href=group_settings> to the profile card for groups, if the current actor can access them
*/
public function onAppendCardProfile(array $vars, array &$res): bool public function onAppendCardProfile(array $vars, array &$res): bool
{ {
$actor = Common::actor(); $actor = Common::actor();

View File

@ -86,6 +86,9 @@ class Tag extends Controller
); );
} }
/**
* Generic settings page for an Actor's self tags
*/
public static function settingsSelfTags(Request $request, E\Actor $target, string $details_id) public static function settingsSelfTags(Request $request, E\Actor $target, string $details_id)
{ {
$actor = Common::actor(); $actor = Common::actor();
@ -98,7 +101,10 @@ class Tag extends Controller
[$add_form, $existing_form] = SelfTagsForm::handleTags( [$add_form, $existing_form] = SelfTagsForm::handleTags(
$request, $request,
$actor_tags, $actor_tags,
handle_new: function ($form) use ($request, $target, $details_id) { handle_new: /**
* Handle adding tags
*/
function ($form) use ($request, $target, $details_id) {
$data = $form->getData(); $data = $form->getData();
$tags = $data['new-tags']; $tags = $data['new-tags'];
$language = $target->getTopLanguage()->getLocale(); $language = $target->getTopLanguage()->getLocale();
@ -117,7 +123,10 @@ class Tag extends Controller
Cache::delete(E\Actor::cacheKeys($target->getId(), $target->getId())['tags']); Cache::delete(E\Actor::cacheKeys($target->getId(), $target->getId())['tags']);
throw new RedirectException($request->get('_route'), ['nickname' => $target->getNickname(), 'open' => $details_id]); throw new RedirectException($request->get('_route'), ['nickname' => $target->getNickname(), 'open' => $details_id]);
}, },
handle_existing: function ($form, array $form_definition) use ($request, $target, $details_id) { handle_existing: /**
* Handle changes to the existing tags
*/
function ($form, array $form_definition) use ($request, $target, $details_id) {
$data = $form->getData(); $data = $form->getData();
$changed = false; $changed = false;
foreach (array_chunk($form_definition, 3) as $entry) { foreach (array_chunk($form_definition, 3) as $entry) {

View File

@ -76,9 +76,14 @@ class TagBasedFiltering extends Plugin
]; ];
} }
/**
* Filter out tags from notes or actors, per the user request
*/
public function onFilterNoteList(?Actor $actor, array &$notes, Request $request) public function onFilterNoteList(?Actor $actor, array &$notes, Request $request)
{ {
if (\is_null($actor)) return Event::next; if (\is_null($actor)) {
return Event::next;
}
$blocked_note_tags = Cache::get( $blocked_note_tags = Cache::get(
self::cacheKeys($actor)['note'], self::cacheKeys($actor)['note'],
fn () => DB::dql('select ntb from note_tag_block ntb where ntb.blocker = :blocker', ['blocker' => $actor->getId()]), fn () => DB::dql('select ntb from note_tag_block ntb where ntb.blocker = :blocker', ['blocker' => $actor->getId()]),