Clean up @odysee membership channel definition

This commit is contained in:
infinite-persistence 2022-05-23 10:33:23 +08:00
parent 8eb6ffd2b9
commit 104dafc1e7
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
3 changed files with 15 additions and 10 deletions

View file

@ -21,3 +21,11 @@ export const COMMUNITY_CHANNELS = Object.freeze({
es: ES_CHANNELS, es: ES_CHANNELS,
de: DE_CHANNELS, de: DE_CHANNELS,
}); });
// ****************************************************************************
// ****************************************************************************
export const ODYSEE_CHANNEL = Object.freeze({
ID: '80d2590ad04e36fb1d077a9b9e3a8bba76defdf8',
NAME: '@odysee',
});

View file

@ -6,6 +6,7 @@ import Page from 'component/page';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import { getStripeEnvironment } from 'util/stripe'; import { getStripeEnvironment } from 'util/stripe';
import { ODYSEE_CHANNEL } from 'constants/channels';
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import * as MODALS from 'constants/modal_types'; import * as MODALS from 'constants/modal_types';
@ -21,10 +22,6 @@ import usePersistedState from 'effects/use-persisted-state';
const stripeEnvironment = getStripeEnvironment(); const stripeEnvironment = getStripeEnvironment();
const isDev = process.env.NODE_ENV !== 'production'; const isDev = process.env.NODE_ENV !== 'production';
// odysee channel information since the memberships are only for Odysee
const odyseeChannelId = '80d2590ad04e36fb1d077a9b9e3a8bba76defdf8';
const odyseeChannelName = '@odysee';
function log(...args) { function log(...args) {
// @if process.env.LOG_MEMBERSHIP='true' // @if process.env.LOG_MEMBERSHIP='true'
console.log(args); console.log(args);
@ -180,8 +177,9 @@ const OdyseeMembershipPage = (props: Props) => {
'list', 'list',
{ {
environment: stripeEnvironment, environment: stripeEnvironment,
channel_id: odyseeChannelId, // Using @odysee's channel info as memberships are only for @odysee.
channel_name: odyseeChannelName, channel_id: ODYSEE_CHANNEL.ID,
channel_name: ODYSEE_CHANNEL.NAME,
}, },
'post' 'post'
); );

View file

@ -4,7 +4,7 @@ import { doFetchChannelListMine } from 'redux/actions/claims';
import { isURIValid, normalizeURI } from 'util/lbryURI'; import { isURIValid, normalizeURI } from 'util/lbryURI';
import { batchActions } from 'util/batch-actions'; import { batchActions } from 'util/batch-actions';
import { getStripeEnvironment } from 'util/stripe'; import { getStripeEnvironment } from 'util/stripe';
import { ODYSEE_CHANNEL } from 'constants/channels';
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import { doFetchGeoBlockedList } from 'redux/actions/blocked'; import { doFetchGeoBlockedList } from 'redux/actions/blocked';
import { doClaimRewardType, doRewardList } from 'redux/actions/rewards'; import { doClaimRewardType, doRewardList } from 'redux/actions/rewards';
@ -15,14 +15,13 @@ import rewards from 'rewards';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import { DOMAIN, LOCALE_API } from 'config'; import { DOMAIN, LOCALE_API } from 'config';
import { getDefaultLanguage } from 'util/default-languages'; import { getDefaultLanguage } from 'util/default-languages';
const AUTH_IN_PROGRESS = 'authInProgress'; const AUTH_IN_PROGRESS = 'authInProgress';
export let sessionStorageAvailable = false; export let sessionStorageAvailable = false;
const CHECK_INTERVAL = 200; const CHECK_INTERVAL = 200;
const AUTH_WAIT_TIMEOUT = 10000; const AUTH_WAIT_TIMEOUT = 10000;
const stripeEnvironment = getStripeEnvironment(); const stripeEnvironment = getStripeEnvironment();
const ODYSEE_CHANNEL_ID = '80d2590ad04e36fb1d077a9b9e3a8bba76defdf8';
export function doFetchInviteStatus(shouldCallRewardList = true) { export function doFetchInviteStatus(shouldCallRewardList = true) {
return (dispatch) => { return (dispatch) => {
dispatch({ dispatch({
@ -912,7 +911,7 @@ export function doFetchUserMemberships(claimIdCsv) {
// check if users have odysee memberships (premium/premium+) // check if users have odysee memberships (premium/premium+)
const response = await Lbryio.call('membership', 'check', { const response = await Lbryio.call('membership', 'check', {
channel_id: ODYSEE_CHANNEL_ID, channel_id: ODYSEE_CHANNEL.ID,
claim_ids: claimIdCsv, claim_ids: claimIdCsv,
environment: stripeEnvironment, environment: stripeEnvironment,
}); });