{
const urlParams = new URLSearchParams(search);
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
+ const claim = selectClaimForUri(state, uri);
return {
+ channelId: getChannelIdFromClaim(claim),
linkedCommentId: urlParams.get('lc'),
costInfo: selectCostInfoForUri(state, uri),
obscureNsfw: !selectShowMatureContent(state),
@@ -34,7 +38,8 @@ const select = (state, props) => {
fileInfo: makeSelectFileInfoForUri(uri)(state),
renderMode: makeSelectFileRenderModeForUri(uri)(state),
videoTheaterMode: selectClientSetting(state, SETTINGS.VIDEO_THEATER_MODE),
- commentsDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_COMMENTS_TAG)(state),
+ contentCommentsDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_COMMENTS_TAG)(state),
+ settingsByChannelId: selectSettingsByChannelId(state),
isLivestream: selectIsStreamPlaceholderForUri(state, uri),
hasCollectionById: Boolean(makeSelectCollectionForId(collectionId)(state)),
collectionId,
diff --git a/ui/page/file/view.jsx b/ui/page/file/view.jsx
index 1f47e00a2..5b037a4d5 100644
--- a/ui/page/file/view.jsx
+++ b/ui/page/file/view.jsx
@@ -28,6 +28,7 @@ type Props = {
costInfo: ?{ includesData: boolean, cost: number },
fileInfo: FileListItem,
uri: string,
+ channelId?: string,
renderMode: string,
obscureNsfw: boolean,
isMature: boolean,
@@ -36,10 +37,11 @@ type Props = {
collectionId: string,
videoTheaterMode: boolean,
claimIsMine: boolean,
- commentsDisabled: boolean,
+ contentCommentsDisabled: boolean,
isLivestream: boolean,
position: number,
commentsListTitle: string,
+ settingsByChannelId: { [channelId: string]: PerChannelSettings },
doFetchCostInfoForUri: (uri: string) => void,
doSetContentHistoryItem: (uri: string) => void,
doSetPrimaryUri: (uri: ?string) => void,
@@ -49,6 +51,7 @@ type Props = {
export default function FilePage(props: Props) {
const {
uri,
+ channelId,
renderMode,
fileInfo,
obscureNsfw,
@@ -58,12 +61,13 @@ export default function FilePage(props: Props) {
videoTheaterMode,
claimIsMine,
- commentsDisabled,
+ contentCommentsDisabled,
hasCollectionById,
collectionId,
isLivestream,
position,
commentsListTitle,
+ settingsByChannelId,
doFetchCostInfoForUri,
doSetContentHistoryItem,
doSetPrimaryUri,
@@ -75,6 +79,8 @@ export default function FilePage(props: Props) {
// Auto-open the drawer on Mobile view if there is a linked comment
const [showComments, setShowComments] = React.useState(linkedCommentId);
+ const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
+ const commentSettingDisabled = channelSettings && !channelSettings.comments_enabled;
const cost = costInfo ? costInfo.cost : null;
const hasFileInfo = fileInfo !== undefined;
const isMarkdown = renderMode === RENDER_MODES.MARKDOWN;
@@ -188,6 +194,7 @@ export default function FilePage(props: Props) {
}
const commentsListProps = { uri, linkedCommentId };
+ const emptyMsgProps = { padded: !isMobile };
return (
@@ -213,8 +220,10 @@ export default function FilePage(props: Props) {
{RENDER_MODES.FLOATING_MODES.includes(renderMode) && }
- {commentsDisabled ? (
-
+ {contentCommentsDisabled ? (
+
+ ) : commentSettingDisabled ? (
+
) : isMobile ? (
<>
- : !commentsDisabled && (
+ : !contentCommentsDisabled && (