mirror of
https://github.com/friendica/friendica
synced 2025-05-06 15:04:10 +02:00
Move unfollow protocol to worker task
- Add uid parameter to unfollow hook - Rework and unify Contact::unfollow, Contact::removeSharer and Contact::terminateFriendship - Add missing twitterUser property to Twitter\Friendships\Destroy module
This commit is contained in:
parent
48e2963ac7
commit
6a1f9a7fa3
11 changed files with 159 additions and 78 deletions
|
@ -199,19 +199,18 @@ HELP;
|
|||
throw new RuntimeException('Contact not found');
|
||||
}
|
||||
|
||||
$user = UserModel::getById($contact['uid']);
|
||||
if (empty($contact['uid'])) {
|
||||
throw new RuntimeException('Contact must be user-specific (uid != 0)');
|
||||
}
|
||||
|
||||
try {
|
||||
$result = ContactModel::terminateFriendship($user, $contact);
|
||||
if ($result === false) {
|
||||
throw new RuntimeException('Unable to unfollow this contact, please retry in a few minutes or check the logs.');
|
||||
}
|
||||
ContactModel::unfollow($contact);
|
||||
|
||||
$this->out('Contact was successfully unfollowed');
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
DI::logger()->error($e->getMessage(), ['owner' => $user, 'contact' => $contact]);
|
||||
DI::logger()->error($e->getMessage(), ['contact' => $contact]);
|
||||
throw new RuntimeException('Unable to unfollow this contact, please check the log');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue