mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
reverse roadmap order, light github cleanup
This commit is contained in:
parent
a19bcfd6f7
commit
497fcc8541
3 changed files with 28 additions and 23 deletions
|
@ -254,16 +254,16 @@ class ContentActions extends Actions
|
|||
{
|
||||
if ($items)
|
||||
{
|
||||
$lastItem = end($items);
|
||||
$project = $lastItem['project'];
|
||||
if (!isset($projectMaxVersions[$project]) || $lastItem['sort_key'] > $projectMaxVersions[$project])
|
||||
$firstItem = reset($items);
|
||||
$project = $firstItem['project'];
|
||||
if (!isset($projectMaxVersions[$project]) || $firstItem['sort_key'] > $projectMaxVersions[$project])
|
||||
{
|
||||
$projectMaxVersions[$project] = $lastItem['sort_key'];
|
||||
$projectMaxVersions[$project] = $firstItem['sort_key'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$items = array_merge($githubItems, Asana::listRoadmapTasks($cache));
|
||||
$items = array_merge(Asana::listRoadmapTasks($cache), $githubItems);
|
||||
return ['content/roadmap', [
|
||||
'projectMaxVersions' => $projectMaxVersions,
|
||||
'items' => $items
|
||||
|
|
28
lib/thirdparty/Github.class.php
vendored
28
lib/thirdparty/Github.class.php
vendored
|
@ -29,7 +29,7 @@ class Github
|
|||
{
|
||||
try
|
||||
{
|
||||
return static::get('/repos/lbryio/lbry-app/releases/latest', $cache);
|
||||
return static::get('/repos/lbryio/lbry-app/releases/latest', [], $cache);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ class Github
|
|||
{
|
||||
try
|
||||
{
|
||||
$releases = static::get('/repos/lbryio/lbry-app/releases', $cache);
|
||||
$releases = static::get('/repos/lbryio/lbry-app/releases', [], $cache);
|
||||
if (count($releases))
|
||||
{
|
||||
$asset = static::findReleaseAssetForOs($releases[0], $os);
|
||||
|
@ -79,7 +79,7 @@ class Github
|
|||
|
||||
try
|
||||
{
|
||||
$releaseData = static::get('/repos/lbryio/lbry/releases/latest', $cache);
|
||||
$releaseData = static::get('/repos/lbryio/lbry/releases/latest', [], $cache);
|
||||
foreach ($releaseData['assets'] as $asset)
|
||||
{
|
||||
if (
|
||||
|
@ -104,10 +104,10 @@ class Github
|
|||
return static::getDaemonReleaseProperty($os, 'browser_download_url', true);
|
||||
}
|
||||
|
||||
public static function get($endpoint, $cache = true)
|
||||
public static function get($endpoint, array $params = [], $cache = true)
|
||||
{
|
||||
$twoHoursInSeconds = 7200;
|
||||
return CurlWithCache::get('https://api.github.com' . $endpoint, [],
|
||||
return CurlWithCache::get('https://api.github.com' . $endpoint . '?' . http_build_query($params), [],
|
||||
['user_agent' => 'LBRY', 'json_response' => true, 'cache' => $cache === true ? $twoHoursInSeconds : $cache]);
|
||||
}
|
||||
|
||||
|
@ -116,14 +116,14 @@ class Github
|
|||
$sets = [];
|
||||
$allReleases = [];
|
||||
|
||||
$projects = ['lbry' => 'Daemon', 'lbry-app' => 'App'];
|
||||
$projects = ['lbry' => 'LBRY Protocol', 'lbry-app' => 'LBRY App'];
|
||||
|
||||
foreach($projects as $project => $projectLabel)
|
||||
{
|
||||
$page = 1;
|
||||
do
|
||||
{
|
||||
$releases = static::get('/repos/lbryio/' . $project . '/releases?page=' . $page, $cache);
|
||||
$releases = static::get('/repos/lbryio/' . $project . '/releases', ['page' => $page], $cache);
|
||||
$page++;
|
||||
$allReleases = array_merge($allReleases, array_map(function ($release) use ($project, $projectLabel)
|
||||
{
|
||||
|
@ -135,6 +135,11 @@ class Github
|
|||
} while (count($releases) >= 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* This logic is likely overly convoluted at this point. It used to group releases by project before going
|
||||
* to strictly by time. - Jeremy
|
||||
*/
|
||||
|
||||
foreach ($allReleases as $release)
|
||||
{
|
||||
$group = null;
|
||||
|
@ -148,10 +153,11 @@ class Github
|
|||
$sets[$group][] = array_intersect_key($release, [
|
||||
'prerelease' => null, 'tag_name' => null, 'published_at' => null, 'project' => null
|
||||
]) + [
|
||||
'created_at' => strtotime($release['created_at']),
|
||||
'date' => date('Y-m-d', strtotime($release['created_at'])),
|
||||
//I thought published_at, but GitHub displays created_at and published_at is out of sync sometimes (0.3.2, 0.3.3)
|
||||
'name' => $release['name'] ?: $release['tag_name'],
|
||||
'url' => $release['html_url'],
|
||||
'url' => $release['html_url'],
|
||||
'major_version' => (int)$matches[1],
|
||||
'minor_version' => (int)$matches[2],
|
||||
'patch_version' => (int)isset($matches[3]) ? $matches[3] : 0,
|
||||
|
@ -168,12 +174,12 @@ class Github
|
|||
{
|
||||
return $sA[0]['project'] < $sB[0]['project'] ? -1 : 1;
|
||||
}
|
||||
return $sA[0]['sort_key'] < $sB[0]['sort_key'] ? -1 : 1;
|
||||
return $sB[0]['sort_key'] <=> $sA[0]['sort_key'];
|
||||
});
|
||||
|
||||
|
||||
foreach ($sets as $group => &$groupSet)
|
||||
{
|
||||
usort($groupSet, function ($rA, $rB) { return $rA['created_at'] <=> $rB['created_at']; });
|
||||
usort($groupSet, function ($rA, $rB) { return $rB['created_at'] <=> $rA['created_at']; });
|
||||
}
|
||||
|
||||
return $sets;
|
||||
|
|
|
@ -26,25 +26,23 @@
|
|||
</div>
|
||||
<div style="max-width: 800px; margin: 0 auto">
|
||||
<div class="roadmap-container" id="project-roadmap">
|
||||
<div class="text-center"><a href="javascript:;" class="link-primary show-all-roadmap-groups">Show Earlier Releases</a></div>
|
||||
<?php foreach($items as $group => $groupItems): ?>
|
||||
<?php $lastItem = end($groupItems) ?>
|
||||
<?php $isOpen = !isset($lastItem['project']) || !isset($lastItem['sort_key']) || $lastItem['sort_key'] === $projectMaxVersions[$lastItem['project']] ?>
|
||||
<?php $firstItem = reset($groupItems) ?>
|
||||
<?php $isOpen = !isset($firstItem['project']) || !isset($firstItem['sort_key']) || $firstItem['sort_key'] === $projectMaxVersions[$firstItem['project']] ?>
|
||||
<h2 class="roadmap-group-title" <?php echo !$isOpen ? 'style="display: none"' : '' ?>">
|
||||
<span class="roadmap-group-title-label">
|
||||
<?php echo $group ?> <?php echo isset($lastItem['sort_key']) && $lastItem['sort_key'] === $projectMaxVersions[$lastItem['project']] ? '(latest)' : '' ?>
|
||||
<?php echo $group ?> <?php echo isset($firstItem['sort_key']) && $firstItem['sort_key'] === $projectMaxVersions[$firstItem['project']] ? '(latest)' : '' ?>
|
||||
</span>
|
||||
</h2>
|
||||
<div class="roadmap-group <?php echo !$isOpen ? 'roadmap-group-closed' : '' ?>">
|
||||
<?php $lastItem = end($groupItems) ?>
|
||||
<?php $maxItems = isset($lastItem['sort_key']) ? 1 : count($groupItems) ?>
|
||||
<?php $maxItems = isset($firstItem['sort_key']) ? 1 : count($groupItems) ?>
|
||||
<?php $index = 0 ?>
|
||||
<?php if (count($groupItems) > $maxItems): ?>
|
||||
<div class="text-center spacer1"><a href="javascript:;" class="link-primary show-all-roadmap-group-items">Show All Items for <?php echo $group ?></a></div>
|
||||
<?php endif ?>
|
||||
<?php foreach($groupItems as $item): ?>
|
||||
<?php ++$index ?>
|
||||
<div class="roadmap-item" <?php echo $index <= count($groupItems) - $maxItems ? 'style="display: none"' : '' ?>>
|
||||
<div class="roadmap-item" <?php echo $index != 1 ? 'style="display: none"' : '' ?>>
|
||||
<?php if (isset($item['badge']) || isset($item['assignee'])): ?>
|
||||
<div>
|
||||
<?php if (isset($item['assignee'])): ?>
|
||||
|
@ -73,6 +71,7 @@
|
|||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<div class="text-center"><a href="javascript:;" class="link-primary show-all-roadmap-groups">Show Earlier Releases</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo View::render('nav/_learnFooter') ?>
|
||||
|
|
Loading…
Add table
Reference in a new issue