4688b4bf58
## Ticket 6879: Previously pinned livestream comments show as latest ## Issue `comment.List` will always display the pinned comment first, hence the problem when the chat is refreshed. ## Approach Completely split pinned comments from top-level comments in the Reducer, and the let the GUI (e.g. regular comments, livestream comments) decide how they want to display it. For the case of livestream, there is no need to repeat the pinned comments in the regular chat area, since there is a dedicated area on top.
52 lines
2.1 KiB
JavaScript
52 lines
2.1 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import {
|
|
makeSelectClaimForUri,
|
|
makeSelectClaimIsMine,
|
|
selectFetchingMyChannels,
|
|
selectMyChannelClaims,
|
|
} from 'lbry-redux';
|
|
import {
|
|
makeSelectTopLevelCommentsForUri,
|
|
makeSelectTopLevelTotalPagesForUri,
|
|
selectIsFetchingComments,
|
|
selectIsFetchingReacts,
|
|
makeSelectTotalCommentsCountForUri,
|
|
selectOthersReactsById,
|
|
selectMyReactionsByCommentId,
|
|
makeSelectCommentIdsForUri,
|
|
selectSettingsByChannelId,
|
|
makeSelectPinnedCommentsForUri,
|
|
} from 'redux/selectors/comments';
|
|
import { doCommentReset, doCommentList, doCommentById, doCommentReactList } from 'redux/actions/comments';
|
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
|
import CommentsList from './view';
|
|
|
|
const select = (state, props) => {
|
|
const activeChannelClaim = selectActiveChannelClaim(state);
|
|
return {
|
|
myChannels: selectMyChannelClaims(state),
|
|
allCommentIds: makeSelectCommentIdsForUri(props.uri)(state),
|
|
pinnedComments: makeSelectPinnedCommentsForUri(props.uri)(state),
|
|
topLevelComments: makeSelectTopLevelCommentsForUri(props.uri)(state),
|
|
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(props.uri)(state),
|
|
totalComments: makeSelectTotalCommentsCountForUri(props.uri)(state),
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
|
isFetchingComments: selectIsFetchingComments(state),
|
|
isFetchingReacts: selectIsFetchingReacts(state),
|
|
fetchingChannels: selectFetchingMyChannels(state),
|
|
settingsByChannelId: selectSettingsByChannelId(state),
|
|
myReactsByCommentId: selectMyReactionsByCommentId(state),
|
|
othersReactsById: selectOthersReactsById(state),
|
|
activeChannelId: activeChannelClaim && activeChannelClaim.claim_id,
|
|
};
|
|
};
|
|
|
|
const perform = (dispatch) => ({
|
|
fetchTopLevelComments: (uri, page, pageSize, sortBy) => dispatch(doCommentList(uri, '', page, pageSize, sortBy)),
|
|
fetchComment: (commentId) => dispatch(doCommentById(commentId)),
|
|
fetchReacts: (commentIds) => dispatch(doCommentReactList(commentIds)),
|
|
resetComments: (uri) => dispatch(doCommentReset(uri)),
|
|
});
|
|
|
|
export default connect(select, perform)(CommentsList);
|