mirror of
https://github.com/friendica/friendica
synced 2025-04-24 00:30:11 +00:00
Fix follow/unfollow
This commit is contained in:
parent
26f8392754
commit
534db0d09a
23 changed files with 236 additions and 90 deletions
|
@ -81,9 +81,9 @@ class NewDM extends BaseApi
|
|||
}
|
||||
}
|
||||
|
||||
$cdata = Contact::getPublicAndUserContactID($cid, $uid);
|
||||
$ucid = Contact::getUserContactId($cid, $uid);
|
||||
|
||||
$id = Mail::send($uid, $cdata['user'], $request['text'], $sub, $replyto);
|
||||
$id = Mail::send($uid, $ucid, $request['text'], $sub, $replyto);
|
||||
|
||||
if ($id > -1) {
|
||||
$ret = $this->directMessage->createFromMailId($id, $uid, $this->getRequestValue($request, 'getText', ''));
|
||||
|
|
|
@ -88,9 +88,9 @@ abstract class DirectMessagesEndpoint extends BaseApi
|
|||
|
||||
$cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'screen_name', ''), $this->getRequestValue($request, 'profileurl', ''), $this->getRequestValue($request, 'user_id', 0), 0);
|
||||
if (!empty($cid)) {
|
||||
$cdata = Contact::getPublicAndUserContactID($cid, $uid);
|
||||
if (!empty($cdata['user'])) {
|
||||
$condition = DBA::mergeConditions($condition, ["`contact-id` = ?", $cdata['user']]);
|
||||
$ucid = Contact::getUserContactId($cid, $uid);
|
||||
if ($ucid) {
|
||||
$condition = DBA::mergeConditions($condition, ["`contact-id` = ?", $ucid]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@ class Destroy extends ContactEndpoint
|
|||
}
|
||||
|
||||
// Get Contact by given id
|
||||
$cdata = Contact::getPublicAndUserContactID($contact_id, $uid);
|
||||
if (!empty($cdata['user'])) {
|
||||
$ucid = Contact::getUserContactId($contact_id, $uid);
|
||||
if (!$ucid) {
|
||||
Logger::notice(BaseApi::LOG_PREFIX . 'Not following contact', ['module' => 'api', 'action' => 'friendships_destroy']);
|
||||
throw new HTTPException\NotFoundException('Not following Contact');
|
||||
}
|
||||
|
||||
$contact = Contact::getById($cdata['user']);
|
||||
$contact = Contact::getById($ucid);
|
||||
$user = $this->twitterUser->createFromContactId($contact_id, $uid, true)->toArray();
|
||||
|
||||
try {
|
||||
|
|
|
@ -55,9 +55,9 @@ class Show extends ContactEndpoint
|
|||
$following = false;
|
||||
|
||||
if ($source_cid == Contact::getPublicIdByUserId($uid)) {
|
||||
$cdata = Contact::getPublicAndUserContactID($target_cid, $uid);
|
||||
if (!empty($cdata['user'])) {
|
||||
$usercontact = Contact::getById($cdata['user'], ['rel']);
|
||||
$ucid = Contact::getUserContactId($target_cid, $uid);
|
||||
if ($ucid) {
|
||||
$usercontact = Contact::getById($ucid, ['rel']);
|
||||
switch ($usercontact['rel'] ?? Contact::NOTHING) {
|
||||
case Contact::FOLLOWER:
|
||||
$follower = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue