Fix comment channel not checked in Livestreams
## Change Moved the fetch from `CommentList` to `CommentCreate` instead, which is used by both Content and Livestreams comments.
This commit is contained in:
parent
26f9cf3a4f
commit
208b701998
4 changed files with 25 additions and 27 deletions
|
@ -5,14 +5,20 @@ import {
|
|||
selectHasChannels,
|
||||
selectFetchingMyChannels,
|
||||
makeSelectTagInClaimOrChannelForUri,
|
||||
selectMyChannelClaimIds,
|
||||
} from 'redux/selectors/claims';
|
||||
import { CommentCreate } from './view';
|
||||
import { DISABLE_SUPPORT_TAG } from 'constants/tags';
|
||||
import { doCommentCreate, doFetchCreatorSettings, doCommentById } from 'redux/actions/comments';
|
||||
import {
|
||||
doCommentCreate,
|
||||
doFetchCreatorSettings,
|
||||
doCommentById,
|
||||
doFetchMyCommentedChannels,
|
||||
} from 'redux/actions/comments';
|
||||
import { doSendTip, doSendCashTip } from 'redux/actions/wallet';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||
import { selectMyCommentedChannelIdsForId, selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
|
@ -45,12 +51,15 @@ const select = (state, props) => {
|
|||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
supportDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_SUPPORT_TAG)(state),
|
||||
preferredCurrency: selectClientSetting(state, SETTINGS.PREFERRED_CURRENCY),
|
||||
myChannelClaimIds: selectMyChannelClaimIds(state),
|
||||
myCommentedChannelIds: selectMyCommentedChannelIdsForId(state, claim?.claim_id),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = {
|
||||
doCommentCreate,
|
||||
doFetchCreatorSettings,
|
||||
doFetchMyCommentedChannels,
|
||||
doToast,
|
||||
doCommentById,
|
||||
doSendCashTip,
|
||||
|
|
|
@ -75,6 +75,9 @@ type Props = {
|
|||
doSendTip: (params: {}, isSupport: boolean, successCb: (any) => void, errorCb: (any) => void, boolean) => void,
|
||||
doOpenModal: (id: string, any) => void,
|
||||
preferredCurrency: string,
|
||||
myChannelClaimIds: ?Array<string>,
|
||||
myCommentedChannelIds: ?Array<string>,
|
||||
doFetchMyCommentedChannels: (claimId: ?string) => void,
|
||||
};
|
||||
|
||||
export function CommentCreate(props: Props) {
|
||||
|
@ -111,6 +114,9 @@ export function CommentCreate(props: Props) {
|
|||
setQuickReply,
|
||||
doOpenModal,
|
||||
preferredCurrency,
|
||||
myChannelClaimIds,
|
||||
myCommentedChannelIds,
|
||||
doFetchMyCommentedChannels,
|
||||
} = props;
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
|
@ -486,6 +492,13 @@ export function CommentCreate(props: Props) {
|
|||
};
|
||||
}, [isLivestream]);
|
||||
|
||||
// Determine my channels that have commented
|
||||
React.useEffect(() => {
|
||||
if (myCommentedChannelIds === undefined && claimId && myChannelClaimIds) {
|
||||
doFetchMyCommentedChannels(claimId);
|
||||
}
|
||||
}, [claimId, myCommentedChannelIds, myChannelClaimIds]);
|
||||
|
||||
// **************************************************************************
|
||||
// Render
|
||||
// **************************************************************************
|
||||
|
|
|
@ -4,7 +4,6 @@ import {
|
|||
selectClaimIsMine,
|
||||
selectFetchingMyChannels,
|
||||
selectClaimsByUri,
|
||||
selectMyChannelClaimIds,
|
||||
} from 'redux/selectors/claims';
|
||||
import {
|
||||
selectTopLevelCommentsForUri,
|
||||
|
@ -18,15 +17,8 @@ import {
|
|||
selectCommentIdsForUri,
|
||||
selectSettingsByChannelId,
|
||||
selectPinnedCommentsForUri,
|
||||
selectMyCommentedChannelIdsForId,
|
||||
} from 'redux/selectors/comments';
|
||||
import {
|
||||
doCommentReset,
|
||||
doCommentList,
|
||||
doCommentById,
|
||||
doCommentReactList,
|
||||
doFetchMyCommentedChannels,
|
||||
} from 'redux/actions/comments';
|
||||
import { doCommentReset, doCommentList, doCommentById, doCommentReactList } from 'redux/actions/comments';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { doFetchUserMemberships } from 'redux/actions/user';
|
||||
|
@ -56,8 +48,6 @@ const select = (state, props) => {
|
|||
othersReactsById: selectOthersReacts(state),
|
||||
activeChannelId: activeChannelClaim && activeChannelClaim.claim_id,
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
myChannelClaimIds: selectMyChannelClaimIds(state),
|
||||
myCommentedChannelIds: selectMyCommentedChannelIdsForId(state, claim?.claim_id),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -67,7 +57,6 @@ const perform = {
|
|||
fetchReacts: doCommentReactList,
|
||||
resetComments: doCommentReset,
|
||||
doFetchUserMemberships,
|
||||
doFetchMyCommentedChannels,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(CommentsList);
|
||||
|
|
|
@ -52,10 +52,7 @@ type Props = {
|
|||
fetchReacts: (commentIds: Array<string>) => Promise<any>,
|
||||
resetComments: (claimId: string) => void,
|
||||
claimsByUri: { [string]: any },
|
||||
myChannelClaimIds: ?Array<string>,
|
||||
myCommentedChannelIds: ?Array<string>,
|
||||
doFetchUserMemberships: (claimIdCsv: string) => void,
|
||||
doFetchMyCommentedChannels: (claimId: ?string) => void,
|
||||
};
|
||||
|
||||
export default function CommentList(props: Props) {
|
||||
|
@ -83,10 +80,7 @@ export default function CommentList(props: Props) {
|
|||
fetchReacts,
|
||||
resetComments,
|
||||
claimsByUri,
|
||||
myChannelClaimIds,
|
||||
myCommentedChannelIds,
|
||||
doFetchUserMemberships,
|
||||
doFetchMyCommentedChannels,
|
||||
} = props;
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
|
@ -268,13 +262,6 @@ export default function CommentList(props: Props) {
|
|||
topLevelTotalPages,
|
||||
]);
|
||||
|
||||
// Determine my channels that have commented
|
||||
useEffect(() => {
|
||||
if (myCommentedChannelIds === undefined && claimId && myChannelClaimIds) {
|
||||
doFetchMyCommentedChannels(claimId);
|
||||
}
|
||||
}, [claimId, myCommentedChannelIds, myChannelClaimIds]);
|
||||
|
||||
const commentProps = { isTopLevel: true, threadDepth: 3, uri, claimIsMine, linkedCommentId };
|
||||
const actionButtonsProps = {
|
||||
totalComments,
|
||||
|
|
Loading…
Reference in a new issue