chg: [internal] Unpublish event timestamp

pull/7934/head
Jakub Onderka 2021-11-06 16:49:56 +01:00
parent d3bc2a0ba9
commit 70d1829ccb
1 changed files with 9 additions and 2 deletions

View File

@ -5817,7 +5817,14 @@ class Event extends AppModel
}
}
public function unpublishEvent($id, $proposalLock = false)
/**
* @param int $id
* @param bool $proposalLock
* @param int|null $timestamp If not provided, current time will be used
* @return array|bool|mixed|null
* @throws Exception
*/
public function unpublishEvent($id, $proposalLock = false, $timestamp = null)
{
$event = $this->find('first', array(
'recursive' => -1,
@ -5829,7 +5836,7 @@ class Event extends AppModel
}
$fields = ['published', 'timestamp'];
$event['Event']['published'] = 0;
$event['Event']['timestamp'] = time();
$event['Event']['timestamp'] = $timestamp ?: time();
if ($proposalLock) {
$event['Event']['proposal_email_lock'] = 0;
$fields[] = 'proposal_email_lock';