diff --git a/controller/action/MailActions.class.php b/controller/action/MailActions.class.php index 7fb87aa5..14683254 100644 --- a/controller/action/MailActions.class.php +++ b/controller/action/MailActions.class.php @@ -80,45 +80,19 @@ class MailActions extends Actions public static function prepareSettingsFormPartial(array $vars) { - 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.' - ], - ] + $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]; } } diff --git a/lib/thirdparty/LBRY.class.php b/lib/thirdparty/LBRY.class.php index 7cd3770e..0cf28ca2 100644 --- a/lib/thirdparty/LBRY.class.php +++ b/lib/thirdparty/LBRY.class.php @@ -23,6 +23,12 @@ class LBRY return $response['data']['lbc_usd'] ?? 0; } + public static function listTags($authToken) + { + $response = Curl::get(static::getApiUrl('/tag/list'), ['auth_token' => $authToken], ['json_response' => true]); + return $response['data'] ?? []; + } + public static function subscribe($email, $tag = null) { return Curl::post(static::getApiUrl('/list/subscribe'), array_filter([ diff --git a/view/template/mail/_settingsForm.php b/view/template/mail/_settingsForm.php index 0a9f7b0a..e83bd80b 100644 --- a/view/template/mail/_settingsForm.php +++ b/view/template/mail/_settingsForm.php @@ -11,49 +11,55 @@