From 206763b2f486a816e5966c3a1548c4d5c7bd41e2 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Wed, 18 Sep 2019 14:51:42 -0400 Subject: [PATCH] Revert "pull tag data from api.lbry.com (#1097)" This reverts commit 5e73137d7e559152f2ee79875bb0c8f1cf51385d. --- controller/action/MailActions.class.php | 55 ++++++++++++++++++------- lib/thirdparty/LBRY.class.php | 7 ---- view/template/mail/_settingsForm.php | 31 +++++++------- 3 files changed, 54 insertions(+), 39 deletions(-) diff --git a/controller/action/MailActions.class.php b/controller/action/MailActions.class.php index 87c40848..90cebe42 100644 --- a/controller/action/MailActions.class.php +++ b/controller/action/MailActions.class.php @@ -68,7 +68,6 @@ class MailActions extends Actions $response['error'] = "This email link is invalid. If you clicked this from an older email it may have been expired for security purposes. Please email help@lbry.com for a valid one."; } $responseData = $response['data'] ?? []; - return ['mail/settings', [ 'emails' => $responseData['emails'] ?? [], 'tags' => $responseData['tags'] ?? [], @@ -79,19 +78,45 @@ class MailActions extends Actions public static function prepareSettingsFormPartial(array $vars) { - $tags = LBRY::listTags($vars['token']); - $tagMetadata = []; - $specialDisplayNames = [ - 'ios' => 'iOS' - ]; - foreach($tags as $tag) { - if ($tag['is_user_addable']) { - $tagMetadata[$tag['name']] = [ - 'label' => $specialDisplayNames[$tag['name']] ?? ucwords(str_replace(['-', '_'], ' ', $tag['name'])), - 'description' => $tag['description'] - ]; - } - } - return $vars + ['tagMetadata' => $tagMetadata]; + return $vars + [ + 'tagMetadata' => [ + '3d-printing' => [ + 'label' => '3D Printing', + 'description' => 'Receive updates, tips, and new content suggestions related to 3D Printing.' + ], + 'android' => [ + 'label' => 'Android', + 'description' => 'Be an Android beta tester, earn LBC, and receive notification when the app goes live!' + ], + 'college' => [ + 'label' => 'University', + 'description' => 'LBRY has special programs and opportunities for people in school.' + ], + 'creator' => [ + 'label' => 'Creator', + 'description' => 'Get the most out of the stuff you create with tips and feedback from LBRY.' + ], + 'consumer' => [ + 'label' => 'Content Lover', + 'description' => 'Learn how to get the most out of LBRY as someone who just wants to find cool stuff.' + ], + 'developer' => [ + 'label' => 'Developer', + 'description' => 'Receive technical updates and other news intended for those who are familiar with software engineering.' + ], + 'ios' => [ + 'label' => 'iPhone', + 'description' => 'Be an iOS alpha tester, earn LBC, and receive notification when the app goes live!' + ], + 'reward' => [ + 'label' => 'Rewards', + 'description' => 'Receive emails about the latest rewards that are available to LBRY users.' + ], + 'subscription' => [ + 'label' => 'Subscriptions', + 'description' => 'Stay up to date on the latest content from your favorite creators.' + ], + ] + ]; } } diff --git a/lib/thirdparty/LBRY.class.php b/lib/thirdparty/LBRY.class.php index 6aeaab6c..9b980d50 100644 --- a/lib/thirdparty/LBRY.class.php +++ b/lib/thirdparty/LBRY.class.php @@ -72,13 +72,6 @@ class LBRY return Curl::get(static::getApiUrl('/yt/status'), ['status_token' => $status_token], ['json_response' => true]); } - public static function listTags($authToken) - { - $response = Curl::get(static::getApiUrl('/tag/list'), ['auth_token' => $authToken], ['json_response' => true]); - return $response['data'] ?? []; - } - - public static function youtubeReward() { return CurlWithCache::post(static::getApiUrl('/yt/rewards'), [], ['cache' => 3600, 'json_response' => true]); diff --git a/view/template/mail/_settingsForm.php b/view/template/mail/_settingsForm.php index b8977a56..0a9f7b0a 100644 --- a/view/template/mail/_settingsForm.php +++ b/view/template/mail/_settingsForm.php @@ -26,7 +26,7 @@ value=""/> - + @@ -39,24 +39,21 @@ $enabled): ?> - + -
- - value=""/> - - - -
+ + value=""/> + + + - -
-