Update api scheduled to use current datetime by default

This commit is contained in:
Your Name 2020-04-19 18:09:59 +02:00
parent 379eaa2786
commit 6c6082ca90
2 changed files with 9 additions and 2 deletions

View file

@ -182,7 +182,7 @@ namespace controllers\publics;
*
* @return : Id of scheduled created
*/
public function post_scheduled()
public function post_scheduled ()
{
$at = $_POST['at'] ?? false;
$text = $_POST['text'] ?? false;
@ -193,6 +193,11 @@ namespace controllers\publics;
$groups = $_POST['groups'] ?? [];
$conditional_groups = $_POST['conditional_groups'] ?? [];
if (!$at)
{
$at = (new \DateTime())->format('Y-m-d H:i:s');
}
if (!$at || !$text)
{
$return = self::DEFAULT_RETURN;