From bc7d21183dc3f4a003d49d3e10e3669884d79e6b Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 6 Nov 2022 06:11:22 +0000 Subject: [PATCH] Issue 11831: Activate "notify on new post" via API --- src/Module/Api/Mastodon/Accounts/Follow.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Module/Api/Mastodon/Accounts/Follow.php b/src/Module/Api/Mastodon/Accounts/Follow.php index 55523635e2..9f3d4b0d37 100644 --- a/src/Module/Api/Mastodon/Accounts/Follow.php +++ b/src/Module/Api/Mastodon/Accounts/Follow.php @@ -40,6 +40,10 @@ class Follow extends BaseApi DI::mstdnError()->UnprocessableEntity(); } + $request = $this->getRequest([ + 'notify' => false, // Notify on new posts. + ], $request); + $contact = Contact::getById($this->parameters['id'], ['url']); $result = Contact::createFromProbeForUser($uid, $contact['url']); @@ -48,6 +52,8 @@ class Follow extends BaseApi DI::mstdnError()->UnprocessableEntity($result['message']); } + Contact::update(['notify_new_posts' => $request['notify']], ['id' => $result['cid']]); + System::jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray()); } }