* SAAS-1197 - fix publish dialog behaviour for tasks with pending states

* SAAS-1184 - more polish on publishing/podcasting
This commit is contained in:
Duncan Sommerville 2015-11-10 17:54:31 -05:00
parent 308457c9f4
commit de380369ed
5 changed files with 56 additions and 36 deletions

View file

@ -79,18 +79,22 @@ abstract class Application_Service_ThirdPartyService {
*
* @param int $fileId the cc_files identifier
*
* @return string the service foreign identifier
* @return int 1 if the file has been published,
* 0 if the file has yet to be published,
* or -1 if the file is in a pending state
*/
public function referenceExists($fileId) {
$ref = ThirdPartyTrackReferencesQuery::create()
->filterByDbService(static::$_SERVICE_NAME)
->findOneByDbFileId($fileId); // There shouldn't be duplicates!
->findOneByDbFileId($fileId);
if (!empty($ref)) {
$task = CeleryTasksQuery::create()
->orderByDbDispatchTime(Criteria::DESC)
->findOneByDbTrackReference($ref->getDbId());
return $task->getDbStatus() != CELERY_FAILED_STATUS;
return $task->getDbStatus() == CELERY_PENDING_STATUS ? -1
: ($task->getDbStatus() == CELERY_FAILED_STATUS ? 0 : 1);
}
return false;
return 0;
}
}