mirror of
https://github.com/friendica/friendica
synced 2025-04-24 00:30:11 +00:00
AP: We can now store received reports
This commit is contained in:
parent
8fd0d4cdc0
commit
ca12d1549b
3 changed files with 59 additions and 1 deletions
|
@ -1821,6 +1821,39 @@ class Processor
|
|||
Queue::remove($activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report a user
|
||||
*
|
||||
* @param array $activity
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function ReportAccount(array $activity)
|
||||
{
|
||||
$account_id = Contact::getIdForURL($activity['object_id']);
|
||||
if (empty($account_id)) {
|
||||
Logger::info('Unknown account', ['activity' => $activity]);
|
||||
Queue::remove($activity);
|
||||
return;
|
||||
}
|
||||
|
||||
$status_ids = $activity['object_ids'];
|
||||
array_shift($status_ids);
|
||||
|
||||
$uri_ids = [];
|
||||
foreach ($status_ids as $status_id) {
|
||||
$post = Post::selectFirst(['uri-id'], ['uri' => $status_id]);
|
||||
if (!empty($post['uri-id'])) {
|
||||
$uri_ids[] = $post['uri-id'];
|
||||
}
|
||||
}
|
||||
|
||||
$report = DI::reportFactory()->createFromReportsRequest(0, $account_id, $activity['content'], false, $uri_ids);
|
||||
DI::report()->save($report);
|
||||
|
||||
Logger::info('Stored report', ['account_id' => $account_id, 'comment' => $activity['content'], 'status_ids' => $status_ids]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept a follow request
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue