Issue 11831: Activate "notify on new post" via API
This commit is contained in:
parent
b9f0985467
commit
bc7d21183d
1 changed files with 6 additions and 0 deletions
|
@ -40,6 +40,10 @@ class Follow extends BaseApi
|
||||||
DI::mstdnError()->UnprocessableEntity();
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$request = $this->getRequest([
|
||||||
|
'notify' => false, // Notify on new posts.
|
||||||
|
], $request);
|
||||||
|
|
||||||
$contact = Contact::getById($this->parameters['id'], ['url']);
|
$contact = Contact::getById($this->parameters['id'], ['url']);
|
||||||
|
|
||||||
$result = Contact::createFromProbeForUser($uid, $contact['url']);
|
$result = Contact::createFromProbeForUser($uid, $contact['url']);
|
||||||
|
@ -48,6 +52,8 @@ class Follow extends BaseApi
|
||||||
DI::mstdnError()->UnprocessableEntity($result['message']);
|
DI::mstdnError()->UnprocessableEntity($result['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Contact::update(['notify_new_posts' => $request['notify']], ['id' => $result['cid']]);
|
||||||
|
|
||||||
System::jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray());
|
System::jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue