Drop UpdateContact worker task if contact is blocked
This commit is contained in:
parent
1f3c07c06f
commit
647ab1d04a
|
@ -25,6 +25,7 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
class UpdateContact
|
class UpdateContact
|
||||||
{
|
{
|
||||||
|
@ -38,6 +39,11 @@ class UpdateContact
|
||||||
*/
|
*/
|
||||||
public static function execute(int $contact_id)
|
public static function execute(int $contact_id)
|
||||||
{
|
{
|
||||||
|
// Silently dropping the task if the contact is blocked
|
||||||
|
if (Contact::isBlocked($contact_id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$success = Contact::updateFromProbe($contact_id);
|
$success = Contact::updateFromProbe($contact_id);
|
||||||
|
|
||||||
Logger::info('Updated from probe', ['id' => $contact_id, 'success' => $success]);
|
Logger::info('Updated from probe', ['id' => $contact_id, 'success' => $success]);
|
||||||
|
@ -55,6 +61,11 @@ class UpdateContact
|
||||||
throw new \InvalidArgumentException('Invalid value provided for contact_id');
|
throw new \InvalidArgumentException('Invalid value provided for contact_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dropping the task if the contact is blocked
|
||||||
|
if (Contact::isBlocked($contact_id)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Worker::add($run_parameters, 'UpdateContact', $contact_id);
|
return Worker::add($run_parameters, 'UpdateContact', $contact_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user