]> git.mxchange.org Git - friendica.git/commitdiff
Issue 11831: Activate "notify on new post" via API
authorMichael <heluecht@pirati.ca>
Sun, 6 Nov 2022 06:11:22 +0000 (06:11 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 6 Nov 2022 06:11:22 +0000 (06:11 +0000)
src/Module/Api/Mastodon/Accounts/Follow.php

index 55523635e21efb92c02b05112e6ecc2ad6761749..9f3d4b0d379f0e15f2e4bc1cdc282cda2cb6c61f 100644 (file)
@@ -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());
        }
 }