mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 08:14:25 +02:00
Fix follow/unfollow
This commit is contained in:
parent
26f8392754
commit
534db0d09a
23 changed files with 236 additions and 90 deletions
|
@ -43,9 +43,9 @@ class Block extends BaseApi
|
|||
|
||||
Contact\User::setBlocked($this->parameters['id'], $uid, true);
|
||||
|
||||
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
|
||||
if (!empty($cdata['user'])) {
|
||||
$contact = Contact::getById($cdata['user']);
|
||||
$ucid = Contact::getUserContactId($this->parameters['id'], $uid);
|
||||
if ($ucid) {
|
||||
$contact = Contact::getById($ucid);
|
||||
if (!empty($contact)) {
|
||||
// Mastodon-expected behavior: relationship is severed on block
|
||||
Contact::terminateFriendship($contact);
|
||||
|
|
|
@ -51,9 +51,9 @@ class Lists extends BaseApi
|
|||
|
||||
$lists = [];
|
||||
|
||||
$cdata = Contact::getPublicAndUserContactID($id, $uid);
|
||||
if (!empty($cdata['user'])) {
|
||||
$circles = DBA::select('group_member', ['gid'], ['contact-id' => $cdata['user']]);
|
||||
$ucid = Contact::getUserContactId($id, $uid);
|
||||
if ($ucid) {
|
||||
$circles = DBA::select('group_member', ['gid'], ['contact-id' => $ucid]);
|
||||
while ($circle = DBA::fetch($circles)) {
|
||||
$lists[] = DI::mstdnList()->createFromCircleId($circle['gid']);
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ class Note extends BaseApi
|
|||
'comment' => '',
|
||||
], $request);
|
||||
|
||||
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
|
||||
if (empty($cdata['user'])) {
|
||||
$ucid = Contact::getUserContactId($this->parameters['id'], $uid);
|
||||
if (!$ucid) {
|
||||
$this->logAndJsonError(404, $this->errorFactory->RecordNotFound());
|
||||
}
|
||||
|
||||
Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]);
|
||||
Contact::update(['info' => $request['comment']], ['id' => $ucid]);
|
||||
|
||||
$this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ class Unfollow extends BaseApi
|
|||
$this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity());
|
||||
}
|
||||
|
||||
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
|
||||
if (empty($cdata['user'])) {
|
||||
$ucid = Contact::getUserContactId($this->parameters['id'], $uid);
|
||||
if (!$ucid) {
|
||||
$this->logAndJsonError(404, $this->errorFactory->RecordNotFound());
|
||||
}
|
||||
|
||||
$contact = Contact::getById($cdata['user']);
|
||||
$contact = Contact::getById($ucid);
|
||||
|
||||
Contact::unfollow($contact);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue