[SSE mobile] Add protection in comments v.2
This commit is contained in:
parent
6044b95c2f
commit
bdac3a4521
|
@ -5,7 +5,7 @@ import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
import { withTranslation} from 'react-i18next';
|
import { withTranslation} from 'react-i18next';
|
||||||
import { LocalStorage } from '../../../utils/LocalStorage';
|
import { LocalStorage } from '../../../utils/LocalStorage';
|
||||||
|
|
||||||
import {AddComment, EditComment, AddReply, EditReply, ViewComments, ViewCurrentComments, ViewAllComments} from '../../view/collaboration/Comments';
|
import {AddComment, EditComment, AddReply, EditReply, ViewComments, ViewCurrentComments} from '../../view/collaboration/Comments';
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
const timeZoneOffsetInMs = (new Date()).getTimezoneOffset() * 60000;
|
const timeZoneOffsetInMs = (new Date()).getTimezoneOffset() * 60000;
|
||||||
|
@ -613,9 +613,9 @@ class ViewCommentsController extends Component {
|
||||||
render() {
|
render() {
|
||||||
return(
|
return(
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{this.props.allComments && <ViewComments onCommentMenuClick={this.onCommentMenuClick} onResolveComment={this.onResolveComment}
|
{this.props.allComments && <ViewComments wsProps={this.props?.storeWorksheets?.wsProps} onCommentMenuClick={this.onCommentMenuClick} onResolveComment={this.onResolveComment}
|
||||||
showComment={this.showComment} />}
|
showComment={this.showComment} />}
|
||||||
{this.state.isOpenViewCurComments && <ViewCurrentComments opened={this.state.isOpenViewCurComments}
|
{this.state.isOpenViewCurComments && <ViewCurrentComments wsProps={this.props?.storeWorksheets?.wsProps} opened={this.state.isOpenViewCurComments}
|
||||||
closeCurComments={this.closeViewCurComments}
|
closeCurComments={this.closeViewCurComments}
|
||||||
onCommentMenuClick={this.onCommentMenuClick}
|
onCommentMenuClick={this.onCommentMenuClick}
|
||||||
onResolveComment={this.onResolveComment}
|
onResolveComment={this.onResolveComment}
|
||||||
|
@ -629,20 +629,6 @@ class ViewCommentsSheetsController extends ViewCommentsController {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<Fragment>
|
|
||||||
{this.props.allComments && <ViewAllComments wsProps={this.props.storeWorksheets.wsProps} onCommentMenuClick={this.onCommentMenuClick} onResolveComment={this.onResolveComment}
|
|
||||||
showComment={this.showComment} />}
|
|
||||||
{this.state.isOpenViewCurComments && <ViewCurrentComments opened={this.state.isOpenViewCurComments}
|
|
||||||
closeCurComments={this.closeViewCurComments}
|
|
||||||
onCommentMenuClick={this.onCommentMenuClick}
|
|
||||||
onResolveComment={this.onResolveComment}
|
|
||||||
/>}
|
|
||||||
</Fragment>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const _CommentsController = inject('storeAppOptions', 'storeComments', 'users', "storeApplicationSettings")(observer(CommentsController));
|
const _CommentsController = inject('storeAppOptions', 'storeComments', 'users', "storeApplicationSettings")(observer(CommentsController));
|
||||||
|
|
|
@ -674,8 +674,8 @@ const ViewComments = inject("storeComments", "storeAppOptions", "storeReview")(o
|
||||||
</div>
|
</div>
|
||||||
{!viewMode &&
|
{!viewMode &&
|
||||||
<div className='right'>
|
<div className='right'>
|
||||||
{(comment.editable && displayMode === 'markup') && <div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'} /></div> }
|
{(comment.editable && displayMode === 'markup' && !wsProps?.Objects) && <div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'} /></div> }
|
||||||
{displayMode === 'markup' &&
|
{(displayMode === 'markup' && !wsProps?.Objects) &&
|
||||||
<div className='comment-menu'
|
<div className='comment-menu'
|
||||||
onClick={() => {setComment(comment); openActionComment(true);}}>
|
onClick={() => {setComment(comment); openActionComment(true);}}>
|
||||||
<Icon icon='icon-menu-comment'/>
|
<Icon icon='icon-menu-comment'/>
|
||||||
|
@ -741,8 +741,7 @@ const ViewComments = inject("storeComments", "storeAppOptions", "storeReview")(o
|
||||||
|
|
||||||
// const _ViewComments = inject('storeComments', 'storeAppOptions', "storeReview")(observer(ViewComments));
|
// const _ViewComments = inject('storeComments', 'storeAppOptions', "storeReview")(observer(ViewComments));
|
||||||
|
|
||||||
|
const CommentList = inject("storeComments", "storeAppOptions", "storeReview")(observer(({storeComments, storeAppOptions, onCommentMenuClick, onResolveComment, storeReview, wsProps}) => {
|
||||||
const CommentList = inject("storeComments", "storeAppOptions", "storeReview")(observer(({storeComments, storeAppOptions, onCommentMenuClick, onResolveComment, storeReview}) => {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('Common.Collaboration', {returnObjects: true});
|
const _t = t('Common.Collaboration', {returnObjects: true});
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
@ -786,7 +785,7 @@ const CommentList = inject("storeComments", "storeAppOptions", "storeReview")(ob
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Toolbar position='bottom'>
|
<Toolbar position='bottom'>
|
||||||
{!viewMode &&
|
{!viewMode &&
|
||||||
<Link className='btn-add-reply' href='#' onClick={() => {onCommentMenuClick('addReply', comment);}}>{_t.textAddReply}</Link>
|
<Link className={`btn-add-reply${wsProps?.Objects ? ' disabled' : ''}`} href='#' onClick={() => {onCommentMenuClick('addReply', comment);}}>{_t.textAddReply}</Link>
|
||||||
}
|
}
|
||||||
<div className='comment-navigation row'>
|
<div className='comment-navigation row'>
|
||||||
<Link href='#' onClick={onViewPrevComment}><Icon slot='media' icon='icon-prev'/></Link>
|
<Link href='#' onClick={onViewPrevComment}><Icon slot='media' icon='icon-prev'/></Link>
|
||||||
|
@ -807,8 +806,8 @@ const CommentList = inject("storeComments", "storeAppOptions", "storeReview")(ob
|
||||||
</div>
|
</div>
|
||||||
{!viewMode &&
|
{!viewMode &&
|
||||||
<div className='right'>
|
<div className='right'>
|
||||||
{(comment.editable && displayMode === 'markup') && <div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'}/></div>}
|
{(comment.editable && displayMode === 'markup' && !wsProps?.Objects) && <div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'}/></div>}
|
||||||
{displayMode === 'markup' &&
|
{(displayMode === 'markup' && !wsProps?.Objects) &&
|
||||||
<div className='comment-menu'
|
<div className='comment-menu'
|
||||||
onClick={() => {openActionComment(true);}}>
|
onClick={() => {openActionComment(true);}}>
|
||||||
<Icon icon='icon-menu-comment'/>
|
<Icon icon='icon-menu-comment'/>
|
||||||
|
@ -871,7 +870,7 @@ const CommentList = inject("storeComments", "storeAppOptions", "storeReview")(ob
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveComment}) => {
|
const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveComment, wsProps}) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
f7.sheet.open('#view-comment-sheet');
|
f7.sheet.open('#view-comment-sheet');
|
||||||
});
|
});
|
||||||
|
@ -917,47 +916,23 @@ const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveCommen
|
||||||
<div id='swipe-handler' className='swipe-container' onTouchStart={handleTouchStart} onTouchMove={handleTouchMove} onTouchEnd={handleTouchEnd}>
|
<div id='swipe-handler' className='swipe-container' onTouchStart={handleTouchStart} onTouchMove={handleTouchMove} onTouchEnd={handleTouchEnd}>
|
||||||
<Icon icon='icon-swipe'/>
|
<Icon icon='icon-swipe'/>
|
||||||
</div>
|
</div>
|
||||||
<CommentList onCommentMenuClick={onCommentMenuClick} onResolveComment={onResolveComment}/>
|
<CommentList wsProps={wsProps} onCommentMenuClick={onCommentMenuClick} onResolveComment={onResolveComment}/>
|
||||||
</Sheet>
|
</Sheet>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const ViewCommentPopover = ({onCommentMenuClick, onResolveComment}) => {
|
const ViewCommentPopover = ({onCommentMenuClick, onResolveComment, wsProps}) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
f7.popover.open('#view-comment-popover', '#btn-coauth');
|
f7.popover.open('#view-comment-popover', '#btn-coauth');
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover id='view-comment-popover' style={{height: '410px'}} closeByOutsideClick={false}>
|
<Popover id='view-comment-popover' style={{height: '410px'}} closeByOutsideClick={false}>
|
||||||
<CommentList onCommentMenuClick={onCommentMenuClick} onResolveComment={onResolveComment} />
|
<CommentList wsProps={wsProps} onCommentMenuClick={onCommentMenuClick} onResolveComment={onResolveComment} />
|
||||||
</Popover>
|
</Popover>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const ViewCommentsPopover = ({wsProps, onCommentMenuClick, onResolveComment, showComment}) => {
|
|
||||||
useEffect(() => {
|
|
||||||
f7.popover.open('#view-comments-popover', '#btn-coauth');
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Popover id='view-comments-popover' style={{height: '410px'}} closeByOutsideClick={false}>
|
|
||||||
<ViewComments wsProps={wsProps} onCommentMenuClick={onCommentMenuClick} onResolveComment={onResolveComment} showComment={showComment} />
|
|
||||||
</Popover>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const ViewCommentsSheet = ({wsProps, onCommentMenuClick, onResolveComment, showComment}) => {
|
|
||||||
useEffect(() => {
|
|
||||||
f7.sheet.open('#view-comments-sheet');
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Sheet id='view-comments-sheet'>
|
|
||||||
<ViewComments wsProps={wsProps} onCommentMenuClick={onCommentMenuClick} onResolveComment={onResolveComment} showComment={showComment} />
|
|
||||||
</Sheet>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const ViewCurrentComments = props => {
|
const ViewCurrentComments = props => {
|
||||||
return (
|
return (
|
||||||
Device.phone ?
|
Device.phone ?
|
||||||
|
@ -966,14 +941,6 @@ const ViewCurrentComments = props => {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const ViewAllComments = props => {
|
|
||||||
return (
|
|
||||||
Device.phone ?
|
|
||||||
<ViewCommentsSheet {...props}/> :
|
|
||||||
<ViewCommentsPopover {...props}/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AddComment,
|
AddComment,
|
||||||
EditComment,
|
EditComment,
|
||||||
|
@ -981,6 +948,5 @@ export {
|
||||||
EditReply,
|
EditReply,
|
||||||
ViewComments,
|
ViewComments,
|
||||||
// _ViewComments as ViewComments,
|
// _ViewComments as ViewComments,
|
||||||
ViewCurrentComments,
|
ViewCurrentComments
|
||||||
ViewAllComments
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue