Skip to content

Commit

Permalink
JI-2084 Fix synced status update after resync
Browse files Browse the repository at this point in the history
  • Loading branch information
icc committed Dec 3, 2020
1 parent 0cf6c8f commit c0d152b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ function hvp_update_hub_status($content) {

// Only check sync status when waiting
if (empty($content['contentHubId']) || $synced !== H5PContentHubSyncStatus::WAITING) {
return;
return false;
}

$core = \mod_hvp\framework::instance();
Expand All @@ -675,6 +675,8 @@ function hvp_update_hub_status($content) {
$core->h5pF->updateContentFields($content['id'], array('synced' => $newstate));
return $newstate;
}

return false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion view.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
// Update Hub status for content before printing out messages
if ($hashub && $isshared) {
$newstate = hvp_update_hub_status($content);
$synced = $newstate ? $newstate : intval($content['synced']);
$synced = $newstate !== false ? $newstate : intval($content['synced']);
$huboptionsdata['canbesynced'] = $synced !== \H5PContentHubSyncStatus::SYNCED && $synced !== \H5PContentHubSyncStatus::WAITING;
$huboptionsdata['waitingclass'] = $synced === \H5PContentHubSyncStatus::WAITING ? '' : ' hidden';
$huboptionsdata['token'] = \H5PCore::createToken('share_' . $id);
Expand Down

0 comments on commit c0d152b

Please sign in to comment.