diff --git a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js index 14efdb1a76..9e88797cc7 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js +++ b/products/ASC.Files/Client/src/components/pages/Home/Section/Body/FilesRowContent.js @@ -5,6 +5,7 @@ import { withRouter } from "react-router"; import styled from "styled-components"; import { RowContent, Link, Text, Icons, Badge, TextInput, Button } from "asc-web-components"; import { renameFolder, updateFile } from '../../../../../store/files/actions'; +import { canWebEdit, canConvert } from '../../../../../store/files/selectors'; class FilesRowContent extends React.PureComponent { @@ -125,8 +126,8 @@ class FilesRowContent extends React.PureComponent { const fileOwner = (this.props.viewer.id === createdBy.id && "Me") || createdBy.displayName; const createdDate = new Date(created).toLocaleString("EN-US"); - const notConverted = ['.pdf', '.zip', '.mp3', '.mp4']; - const canEdit = fileExst && notConverted.includes(fileExst) ? false : true; + const canEditFile = fileExst && canWebEdit(fileExst); + const canConvertFile = fileExst && canConvert(fileExst); const okIcon = {fileExst} - {fileStatus === 4 && + {canConvertFile && } - {canEdit && + {canEditFile && { } return newFilter; }; + +export const canWebEdit = fileExst => { + const editedDocs = ['.pptx', '.pptm', '.ppt', '.ppsx', '.ppsm', '.pps', '.potx', '.potm', '.pot', '.odp', '.fodp', '.otp', '.xlsx', '.xlsm', '.xls', '.xltx', '.xltm', '.xlt', '.ods', '.fods', '.ots', '.csv', '.docx', '.docm', '.doc', '.dotx', '.dotm', '.dot', '.odt', '.fodt', '.ott', '.txt', '.rtf', '.mht', '.html', '.htm']; + const result = editedDocs.findIndex(item => item === fileExst); + return result === -1 ? false : true; +} + +export const canConvert = fileExst => { + const convertedDocs = ['.pptm','.ppt','.ppsm','.pps','.potx','.potm','.pot','.odp','.fodp','.otp','.xlsm','.xls','.xltx','.xltm','.xlt','.ods','.fods','.ots','.docm','.doc','.dotx','.dotm','.dot','.odt','.fodt','.ott','.rtf']; + const result = convertedDocs.findIndex(item => item === fileExst); + return result === -1 ? false : true; +}