Accepting contact request does finally work per Mastodon API
This commit is contained in:
parent
f418687a71
commit
f44c9e7975
|
@ -83,7 +83,10 @@ class Notification extends BaseFactory
|
||||||
public static function getType(Entity\Notification $Notification): string
|
public static function getType(Entity\Notification $Notification): string
|
||||||
{
|
{
|
||||||
if (($Notification->verb == Activity::FOLLOW) && ($Notification->type === Post\UserNotification::TYPE_NONE)) {
|
if (($Notification->verb == Activity::FOLLOW) && ($Notification->type === Post\UserNotification::TYPE_NONE)) {
|
||||||
$contact = Contact::getById($Notification->actorId, ['pending']);
|
$contact = Contact::getById($Notification->actorId, ['pending', 'uri-id', 'uid']);
|
||||||
|
if (($contact['uid'] == 0) && !empty($contact['uri-id'])) {
|
||||||
|
$contact = Contact::selectFirst(['pending', 'uri-id', 'uid'], ['uri-id' => $contact['uri-id'], 'uid' => $Notification->uid]);
|
||||||
|
}
|
||||||
$type = $contact['pending'] ? MstdnNotification::TYPE_INTRODUCTION : MstdnNotification::TYPE_FOLLOW;
|
$type = $contact['pending'] ? MstdnNotification::TYPE_INTRODUCTION : MstdnNotification::TYPE_FOLLOW;
|
||||||
} elseif (($Notification->verb == Activity::ANNOUNCE) &&
|
} elseif (($Notification->verb == Activity::ANNOUNCE) &&
|
||||||
in_array($Notification->type, [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) {
|
in_array($Notification->type, [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) {
|
||||||
|
|
|
@ -47,7 +47,12 @@ class FollowRequests extends BaseApi
|
||||||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
$introduction = DI::intro()->selectOneById($this->parameters['id'], $uid);
|
$cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
|
||||||
|
if (empty($cdata['user'])) {
|
||||||
|
throw new HTTPException\NotFoundException('Contact not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$introduction = DI::intro()->selectForContact($cdata['user']);
|
||||||
|
|
||||||
$contactId = $introduction->cid;
|
$contactId = $introduction->cid;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user