Merge pull request #12123 from annando/issue-11831

Issue 11831: Activate "notify on new post" via API
This commit is contained in:
Tobias Diekershoff 2022-11-06 09:10:34 +01:00 committed by GitHub
commit d0318b3df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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());
}
}