mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
pull tag data from api.lbry.com (#1097)
This commit is contained in:
parent
1a82b1f19f
commit
5e73137d7e
3 changed files with 39 additions and 54 deletions
|
@ -68,6 +68,7 @@ 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.";
|
$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'] ?? [];
|
$responseData = $response['data'] ?? [];
|
||||||
|
|
||||||
return ['mail/settings', [
|
return ['mail/settings', [
|
||||||
'emails' => $responseData['emails'] ?? [],
|
'emails' => $responseData['emails'] ?? [],
|
||||||
'tags' => $responseData['tags'] ?? [],
|
'tags' => $responseData['tags'] ?? [],
|
||||||
|
@ -78,45 +79,19 @@ class MailActions extends Actions
|
||||||
|
|
||||||
public static function prepareSettingsFormPartial(array $vars)
|
public static function prepareSettingsFormPartial(array $vars)
|
||||||
{
|
{
|
||||||
return $vars + [
|
$tags = LBRY::listTags($vars['token']);
|
||||||
'tagMetadata' => [
|
$tagMetadata = [];
|
||||||
'3d-printing' => [
|
$specialDisplayNames = [
|
||||||
'label' => '3D Printing',
|
'ios' => 'iOS'
|
||||||
'description' => 'Receive updates, tips, and new content suggestions related to 3D Printing.'
|
];
|
||||||
],
|
foreach($tags as $tag) {
|
||||||
'android' => [
|
if ($tag['is_user_addable']) {
|
||||||
'label' => 'Android',
|
$tagMetadata[$tag['name']] = [
|
||||||
'description' => 'Be an Android beta tester, earn LBC, and receive notification when the app goes live!'
|
'label' => $specialDisplayNames[$tag['name']] ?? ucwords(str_replace(['-', '_'], ' ', $tag['name'])),
|
||||||
],
|
'description' => $tag['description']
|
||||||
'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.'
|
|
||||||
],
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return $vars + ['tagMetadata' => $tagMetadata];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
7
lib/thirdparty/LBRY.class.php
vendored
7
lib/thirdparty/LBRY.class.php
vendored
|
@ -72,6 +72,13 @@ class LBRY
|
||||||
return Curl::get(static::getApiUrl('/yt/status'), ['status_token' => $status_token], ['json_response' => true]);
|
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()
|
public static function youtubeReward()
|
||||||
{
|
{
|
||||||
return CurlWithCache::post(static::getApiUrl('/yt/rewards'), [], ['cache' => 3600, 'json_response' => true]);
|
return CurlWithCache::post(static::getApiUrl('/yt/rewards'), [], ['cache' => 3600, 'json_response' => true]);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<?php $emailId = 'email_' . (++$emailIndex) ?>
|
<?php $emailId = 'email_' . (++$emailIndex) ?>
|
||||||
<checkbox-element>
|
<checkbox-element>
|
||||||
<input id="<?php echo $emailId ?>" name="<?php echo $emailId ?>" type="checkbox"<?php echo $enabled ? " checked" : "" ?> value="<?php echo urlencode($email) ?>"/>
|
<input id="<?php echo $emailId ?>" name="<?php echo $emailId ?>" type="checkbox"<?php echo $enabled ? " checked" : "" ?> value="<?php echo urlencode($email) ?>"/>
|
||||||
<label for="<?php echo $emailId ?>"><?php echo $email ?></label>
|
<label for="<?php echo $emailId ?>"><?php echo count($emails) > 1 ? $email : __('Yes') . ' (' . $email . ')' ?></label>
|
||||||
<checkbox-toggle/>
|
<checkbox-toggle/>
|
||||||
</checkbox-element>
|
</checkbox-element>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
@ -39,10 +39,9 @@
|
||||||
|
|
||||||
<?php $tagIndex = 0 ?>
|
<?php $tagIndex = 0 ?>
|
||||||
<?php foreach ($tags as $tag => $enabled): ?>
|
<?php foreach ($tags as $tag => $enabled): ?>
|
||||||
<?php if (!isset($tagMetadata[$tag])) {
|
<?php if (!isset($tagMetadata[$tag])) continue; ?>
|
||||||
continue;
|
|
||||||
} //fix/kill this?>
|
|
||||||
<?php $tagId = 'tag_' . (++$tagIndex) ?>
|
<?php $tagId = 'tag_' . (++$tagIndex) ?>
|
||||||
|
<div>
|
||||||
<checkbox-element>
|
<checkbox-element>
|
||||||
<input id="<?php echo $tagId ?>" name="<?php echo $tagId ?>" type="checkbox"<?php echo $enabled ? " checked" : "" ?> value="<?php echo urlencode($tag) ?>"/>
|
<input id="<?php echo $tagId ?>" name="<?php echo $tagId ?>" type="checkbox"<?php echo $enabled ? " checked" : "" ?> value="<?php echo urlencode($tag) ?>"/>
|
||||||
<label for="<?php echo $tagId ?>">
|
<label for="<?php echo $tagId ?>">
|
||||||
|
@ -53,7 +52,11 @@
|
||||||
</label>
|
</label>
|
||||||
<checkbox-toggle/>
|
<checkbox-toggle/>
|
||||||
</checkbox-element>
|
</checkbox-element>
|
||||||
|
</div>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
<?php if ($tagIndex === 0): ?>
|
||||||
|
<div class="notice notice-error"><?php echo __('Something went wrong. Please email help@lbry.com') ?></div>
|
||||||
|
<?php endif ?>
|
||||||
</section>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue