From 60c77616d1773f3f79cb6a16ee0531c58bfa6884 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 28 Feb 2019 17:46:37 -0500 Subject: [PATCH] strip roadmap --- controller/action/ContentActions.class.php | 20 +----- lib/thirdparty/Github.class.php | 73 +-------------------- view/template/content/roadmap.php | 76 ++++++---------------- web/js/roadmap.js | 20 ------ 4 files changed, 21 insertions(+), 168 deletions(-) delete mode 100644 web/js/roadmap.js diff --git a/controller/action/ContentActions.class.php b/controller/action/ContentActions.class.php index da9541f9..8e12e0a3 100644 --- a/controller/action/ContentActions.class.php +++ b/controller/action/ContentActions.class.php @@ -235,26 +235,8 @@ class ContentActions extends Actions { $cache = !Request::getParam('nocache'); - /* - * below will include past changes on the roadmap, considering dropping entirely - */ - -// $githubItems = Github::listRoadmapChangesets($cache); -// $projectMaxVersions = []; -// foreach ($githubItems as $group => $items) { -// if ($items) { -// $firstItem = reset($items); -// $project = $firstItem['project']; -// if (!isset($projectMaxVersions[$project]) || $firstItem['sort_key'] > $projectMaxVersions[$project]) { -// $projectMaxVersions[$project] = $firstItem['sort_key']; -// } -// } -// } - - $items = ['2019' => Github::listRoadmapItems($cache)]; // + $githubItems; return ['content/roadmap', [ - 'projectMaxVersions' => [], - 'items' => $items + 'items' => Github::listRoadmapItems($cache) ]]; } diff --git a/lib/thirdparty/Github.class.php b/lib/thirdparty/Github.class.php index 404445f0..f61f065c 100644 --- a/lib/thirdparty/Github.class.php +++ b/lib/thirdparty/Github.class.php @@ -80,11 +80,6 @@ class Github { $twoHoursInSeconds = 7200; $headers = ['Accept: application/vnd.github.v3.html+json']; -// if (Config::get(Config::GITHUB_APP_CLIENT_ID) && Config::get(Config::GITHUB_APP_CLIENT_SECRET)) -// { -// $params['client_id'] = Config::get(Config::GITHUB_APP_CLIENT_ID); -// $params['client_secret'] = Config::Get(Config::GITHUB_APP_CLIENT_SECRET); -// } if (Config::get(Config::GITHUB_PERSONAL_AUTH_TOKEN)) { $headers[] = 'Authorization: token ' . Config::get(Config::GITHUB_PERSONAL_AUTH_TOKEN); } @@ -98,7 +93,7 @@ class Github public static function listRoadmapItems($cache = true) { - $apiResponse = IS_PRODUCTION ? + $apiResponse = Config::get(Config::GITHUB_PERSONAL_AUTH_TOKEN) ? static::get('/repos/lbryio/internal-issues/issues?labels=2019&filter=all') : include ROOT_DIR . '/data/dummy/githubroadmap.php'; @@ -122,70 +117,4 @@ class Github }); return $issues; } - - public static function listRoadmapChangesets($cache = true) - { - $sets = []; - $allReleases = []; - - $projects = ['lbry' => 'LBRY Protocol', 'lbry-desktop' => 'LBRY App']; - - foreach ($projects as $project => $projectLabel) { - $page = 1; - do { - $releases = static::get('/repos/lbryio/' . $project . '/releases', ['page' => $page], $cache); - $page++; - $allReleases = array_merge($allReleases, array_map(function ($release) use ($project, $projectLabel) { - return $release + ['project' => $projectLabel]; - }, array_filter($releases, function ($release) { - return isset($release['tag_name']) && isset($release['published_at']) && $release['published_at']; - }))); - } 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; - $matches = null; - if (preg_match('/^v(\d+)\.(\d+)\./', $release['tag_name'] ?? '', $matches)) { - $group = $release['project'] . ' v' . $matches[1] . '.' . $matches[2]; - } - if ($group) { - $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'], - 'major_version' => (int)$matches[1], - 'minor_version' => (int)$matches[2], - 'patch_version' => (int)isset($matches[3]) ? $matches[3] : 0, - 'sort_key' => (int)$matches[1] * 1000000 + (int)$matches[2] * 1000 + (int)($matches[3] ?? 0), - 'version' => $matches[1] . '.' . $matches[2] . '.' . (isset($matches[3]) ? $matches[3] : ''), - 'body' => $release['body_html'] - ]; - } - } - - uasort($sets, function ($sA, $sB) { - if ($sA[0]['project'] != $sB[0]['project']) { - return $sA[0]['project'] < $sB[0]['project'] ? -1 : 1; - } - return $sB[0]['sort_key'] <=> $sA[0]['sort_key']; - }); - - foreach ($sets as $group => &$groupSet) { - usort($groupSet, function ($rA, $rB) { - return $rB['created_at'] <=> $rA['created_at']; - }); - } - - return $sets; - } } diff --git a/view/template/content/roadmap.php b/view/template/content/roadmap.php index 48daac3c..69d4db05 100644 --- a/view/template/content/roadmap.php +++ b/view/template/content/roadmap.php @@ -1,10 +1,6 @@ - false]) ?> - - lbry.roadmap('#project-roadmap'); -
@@ -17,61 +13,27 @@

Our top priorities, definitions of success, and target completion dates for key initiatives in are outlined below.

- $groupItems): ?> - - - "> - - - - */ ?> -
- - - $maxItems): ?> - - - - -
> - -
- - -
- -
- -
- - -
+ +
+

+ + + + + +

+
+ + + + -

- - - - - -

-
- - - - - -
-
- No description' ?> -
-
- +
+
+ No description' ?> +
- - Show Earlier Releases
- */ ?> +
diff --git a/web/js/roadmap.js b/web/js/roadmap.js deleted file mode 100644 index f8fbc755..00000000 --- a/web/js/roadmap.js +++ /dev/null @@ -1,20 +0,0 @@ -lbry.roadmap = function(selector) -{ - var roadmap = $(selector); - roadmap.on('click', '.show-all-roadmap-groups', function() { - roadmap.find('.roadmap-group-title').show(); - $(this).remove(); - }); - roadmap.on('click', '.show-all-roadmap-group-items', function() { - $(this).closest('.roadmap-group').find('.roadmap-item').show(); - $(this).remove(); - }); - roadmap.on('click', '.roadmap-group-title', function() { - var target = $(this).next('.roadmap-group'); - target.toggleClass('roadmap-group-closed').toggleClass('roadmap-group-open'); - if (target.hasClass('roadmap-group-open')) - { - target.find('.show-all-roadmap-group-items').click(); - } - }); -} \ No newline at end of file