diff --git a/frontend/src/components/cur-dir-path/dir-tool.js b/frontend/src/components/cur-dir-path/dir-tool.js index 9cda5a4c5d..298819fe4a 100644 --- a/frontend/src/components/cur-dir-path/dir-tool.js +++ b/frontend/src/components/cur-dir-path/dir-tool.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap'; -import { gettext } from '../../utils/constants'; +import { gettext, enableFileTags } from '../../utils/constants'; import { Utils } from '../../utils/utils'; import TextTranslation from '../../utils/text-translation'; import SeahubPopover from '../common/seahub-popover'; @@ -71,7 +71,9 @@ class DirTool extends React.Component { return list; } const { TAGS } = TextTranslation; - list.push(TAGS); + if (enableFileTags) { + list.push(TAGS); + } return list; }; diff --git a/frontend/src/components/dirent-detail/detail-list-view.js b/frontend/src/components/dirent-detail/detail-list-view.js index ac4110d2bb..ce9616fd04 100644 --- a/frontend/src/components/dirent-detail/detail-list-view.js +++ b/frontend/src/components/dirent-detail/detail-list-view.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import moment from 'moment'; import { v4 as uuidv4 } from 'uuid'; import Icon from '../icon'; -import { gettext } from '../../utils/constants'; +import { gettext, enableFileTags } from '../../utils/constants'; import { Utils } from '../../utils/utils'; import EditFileTagPopover from '../popover/edit-filetag-popover'; import FileTagList from '../file-tag-list'; @@ -107,7 +107,9 @@ class DetailListView extends React.Component { {gettext('Tags')} - + {enableFileTags && + + } {direntDetail.permission === 'rw' && window.app.pageOptions.enableMetadataManagement && ( diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index bde67e1d30..0c8bf64475 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -98,6 +98,8 @@ export const enablePDFThumbnail = window.app.pageOptions.enablePDFThumbnail; export const enableOnlyoffice = window.app.pageOptions.enableOnlyoffice || false; export const onlyofficeConverterExtensions = window.app.pageOptions.onlyofficeConverterExtensions || []; +export const enableFileTags = window.app.pageOptions.enableFileTags || false; + // search export const enableElasticsearch = window.app.pageOptions.enableElasticsearch || false; export const enableSeasearch = window.app.pageOptions.enableSeasearch || false; diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 143c4b17ab..120c6a42fd 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -1,4 +1,4 @@ -import { mediaUrl, gettext, serviceURL, siteRoot, isPro, fileAuditEnabled, canGenerateShareLink, canGenerateUploadLink, shareLinkPasswordMinLength, username, folderPermEnabled, onlyofficeConverterExtensions, enableOnlyoffice, enableSeadoc } from './constants'; +import { mediaUrl, gettext, serviceURL, siteRoot, isPro, fileAuditEnabled, canGenerateShareLink, canGenerateUploadLink, shareLinkPasswordMinLength, username, folderPermEnabled, onlyofficeConverterExtensions, enableOnlyoffice, enableSeadoc, enableFileTags } from './constants'; import TextTranslation from './text-translation'; import React from 'react'; import toaster from '../components/toast'; @@ -600,7 +600,9 @@ export const Utils = { } if (permission == 'rw') { - list.push(TAGS); + if (enableFileTags) { + list.push(TAGS); + } if (isPro) { if (dirent.is_locked) { if (dirent.locked_by_me || dirent.lock_owner == 'OnlineOffice' || isRepoOwner || currentRepoInfo.is_admin) { diff --git a/seahub/settings.py b/seahub/settings.py index 25237a0a01..a3e6e9d0c4 100644 --- a/seahub/settings.py +++ b/seahub/settings.py @@ -888,6 +888,9 @@ ENABLE_METADATA_MANAGEMENT = False METADATA_SERVER_URL = '' METADATA_SERVER_SECRET_KEY = '' +# file tags +ENABLE_FILE_TAGS = True + METADATA_FILE_TYPES = { '_picture': ('gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'psd', 'webp', 'jfif', 'mpo', 'jpe', 'xbm', 'svg', 'ppm', 'pcx', 'xcf', 'xpm', 'mgn', 'ufo'), diff --git a/seahub/templates/base_for_react.html b/seahub/templates/base_for_react.html index 9e43f74277..19bc30d2da 100644 --- a/seahub/templates/base_for_react.html +++ b/seahub/templates/base_for_react.html @@ -155,6 +155,7 @@ enableSeaTableIntegration: {% if enable_seatable_integration %} true {% else %} false {% endif %}, isOrgContext: {% if org is not None %} true {% else %} false {% endif %}, enableMetadataManagement: {% if enable_metadata_management %} true {% else %} false {% endif %}, + enableFileTags: {% if enable_file_tags %} true {% else %} false {% endif %} } }; diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py index a59b4fd880..0ed7c1c48d 100644 --- a/seahub/views/__init__.py +++ b/seahub/views/__init__.py @@ -1115,5 +1115,6 @@ def react_fake_view(request, **kwargs): 'group_import_members_extra_msg': GROUP_IMPORT_MEMBERS_EXTRA_MSG, 'request_from_onlyoffice_desktop_editor': ONLYOFFICE_DESKTOP_EDITOR_HTTP_USER_AGENT in request.headers.get('user-agent', ''), 'enable_sso_to_thirdpart_website': settings.ENABLE_SSO_TO_THIRDPART_WEBSITE, - 'enable_metadata_management': settings.ENABLE_METADATA_MANAGEMENT + 'enable_metadata_management': settings.ENABLE_METADATA_MANAGEMENT, + 'enable_file_tags': settings.ENABLE_FILE_TAGS })