don't show attachment button in comments if attachments disabled site-wide

This commit is contained in:
riggraz
2025-02-05 15:46:49 +01:00
parent 064f7a59f3
commit 60819ce357
6 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
.commentsContainer {
@extend .mt-2;
.attachFilesSectionHidden { display: none; }
.commentForm {
@extend
.form-control,

View File

@@ -11,6 +11,7 @@ import CommentFooter from './CommentFooter';
import { StaffIcon } from '../common/Icons';
import Avatar from '../common/Avatar';
import CommentAttachments from './CommentAttachments';
import ITenantSetting from '../../interfaces/ITenantSetting';
interface Props {
id: number;
@@ -32,6 +33,7 @@ interface Props {
handleUpdateComment(commentId: number, body: string, isPostUpdate: boolean, onSuccess: Function): void;
handleDeleteComment(id: number): void;
tenantSetting: ITenantSetting;
isLoggedIn: boolean;
isPowerUser: boolean;
currentUserEmail: string;
@@ -87,6 +89,7 @@ class Comment extends React.Component<Props, State> {
handleSubmitComment,
handleDeleteComment,
tenantSetting,
isLoggedIn,
isPowerUser,
currentUserEmail,
@@ -163,6 +166,7 @@ class Comment extends React.Component<Props, State> {
handlePostUpdateFlag={() => null}
handleSubmit={handleSubmitComment}
allowAttachmentUpload={tenantSetting.allow_attachment_upload}
isLoggedIn={isLoggedIn}
isPowerUser={isPowerUser}
userEmail={currentUserEmail}

View File

@@ -4,6 +4,7 @@ import Comment from './Comment';
import IComment from '../../interfaces/IComment';
import { ReplyFormState } from '../../reducers/replyFormReducer';
import ITenantSetting from '../../interfaces/ITenantSetting';
interface Props {
comments: Array<IComment>;
@@ -18,6 +19,7 @@ interface Props {
handleUpdateComment(commentId: number, body: string, isPostUpdate: boolean, onSuccess: Function): void;
handleDeleteComment(id: number): void;
tenantSetting: ITenantSetting;
isLoggedIn: boolean;
isPowerUser: boolean;
userEmail: string;
@@ -36,6 +38,7 @@ const CommentList = ({
handleUpdateComment,
handleDeleteComment,
tenantSetting,
isLoggedIn,
isPowerUser,
userEmail,
@@ -61,6 +64,7 @@ const CommentList = ({
{...comment}
tenantSetting={tenantSetting}
isLoggedIn={isLoggedIn}
isPowerUser={isPowerUser}
currentUserEmail={userEmail}
@@ -80,6 +84,7 @@ const CommentList = ({
handleUpdateComment={handleUpdateComment}
handleDeleteComment={handleDeleteComment}
tenantSetting={tenantSetting}
isLoggedIn={isLoggedIn}
isPowerUser={isPowerUser}
userEmail={userEmail}

View File

@@ -9,9 +9,11 @@ import { DangerText, MutedText } from '../common/CustomTexts';
import IComment from '../../interfaces/IComment';
import { ReplyFormState } from '../../reducers/replyFormReducer';
import Separator from '../common/Separator';
import ITenantSetting from '../../interfaces/ITenantSetting';
interface Props {
postId: number;
tenantSetting: ITenantSetting;
isLoggedIn: boolean;
isPowerUser: boolean;
userEmail: string;
@@ -90,6 +92,7 @@ class CommentsP extends React.Component<Props> {
render() {
const {
tenantSetting,
isLoggedIn,
isPowerUser,
userEmail,
@@ -123,6 +126,7 @@ class CommentsP extends React.Component<Props> {
handlePostUpdateFlag={toggleCommentIsPostUpdateFlag}
handleSubmit={this._handleSubmitComment}
allowAttachmentUpload={tenantSetting.allow_attachment_upload}
isLoggedIn={isLoggedIn}
isPowerUser={isPowerUser}
userEmail={userEmail}
@@ -149,6 +153,7 @@ class CommentsP extends React.Component<Props> {
handleDeleteComment={this._handleDeleteComment}
parentId={null}
level={1}
tenantSetting={tenantSetting}
isLoggedIn={isLoggedIn}
isPowerUser={isPowerUser}
userEmail={userEmail}

View File

@@ -27,6 +27,7 @@ interface Props {
onSuccess: Function,
): void;
allowAttachmentUpload: boolean;
isLoggedIn: boolean;
isPowerUser: boolean;
userEmail: string;
@@ -43,6 +44,7 @@ const NewComment = ({
handlePostUpdateFlag,
handleSubmit,
allowAttachmentUpload,
isLoggedIn,
isPowerUser,
userEmail,
@@ -99,7 +101,7 @@ const NewComment = ({
}
{ /* Attach files */ }
<div>
<div className={`attachFilesSection${allowAttachmentUpload ? '' : ' attachFilesSectionHidden'}`}>
{
isAttachingFiles ?
<ActionLink

View File

@@ -328,6 +328,7 @@ class PostP extends React.Component<Props, State> {
<Comments
postId={this.props.postId}
tenantSetting={tenantSetting}
isLoggedIn={isLoggedIn}
isPowerUser={isPowerUser}
userEmail={currentUserEmail}