From d057518f5ff33116be2041df632a87e5a584e337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=A1=BA=E5=BC=BA?= Date: Tue, 28 May 2019 08:56:13 +0800 Subject: [PATCH] Share bug repair 2 (#3547) * repair share default data bug * repair folder-img size --- frontend/src/components/dialog/generate-share-link.js | 4 ++-- frontend/src/components/dirent-grid-view/dirent-grid-item.js | 2 +- frontend/src/utils/constants.js | 1 + seahub/templates/base_for_react.html | 1 + seahub/templates/file_view_react.html | 1 + seahub/templates/view_file_markdown.html | 1 + seahub/views/__init__.py | 1 + seahub/views/file.py | 5 ++++- 8 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/dialog/generate-share-link.js b/frontend/src/components/dialog/generate-share-link.js index dcec9e27e0..3303c8b8c5 100644 --- a/frontend/src/components/dialog/generate-share-link.js +++ b/frontend/src/components/dialog/generate-share-link.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import moment from 'moment'; import copy from 'copy-to-clipboard'; import { Button, Form, FormGroup, Label, Input, InputGroup, InputGroupAddon, Alert } from 'reactstrap'; -import { gettext, shareLinkExpireDaysMin, shareLinkExpireDaysMax, shareLinkPasswordMinLength } from '../../utils/constants'; +import { gettext, shareLinkExpireDaysMin, shareLinkExpireDaysMax, shareLinkExpireDaysDefault, shareLinkPasswordMinLength } from '../../utils/constants'; import { seafileAPI } from '../../utils/seafile-api'; import { Utils } from '../../utils/utils'; import SharedLinkInfo from '../../models/shared-link-info'; @@ -27,7 +27,7 @@ class GenerateShareLink extends React.Component { isExpireChecked: false, password: '', passwdnew: '', - expireDays: '', + expireDays: shareLinkExpireDaysDefault, errorInfo: '', sharedLinkInfo: null, isNoticeMessageShow: false, diff --git a/frontend/src/components/dirent-grid-view/dirent-grid-item.js b/frontend/src/components/dirent-grid-view/dirent-grid-item.js index 1ad87daade..af012282bc 100644 --- a/frontend/src/components/dirent-grid-view/dirent-grid-item.js +++ b/frontend/src/components/dirent-grid-view/dirent-grid-item.js @@ -133,7 +133,7 @@ class DirentGridItem extends React.Component { render() { let { dirent, path } = this.props; let direntPath = Utils.joinPath(path, dirent.name); - let iconUrl = Utils.getDirentIcon(dirent); + let iconUrl = Utils.getDirentIcon(dirent, true); let fileUrl = dirent.encoded_thumbnail_src ? this.getFileUrl(dirent.encoded_thumbnail_src) : ''; let dirHref = ''; diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index 0c9189bbcc..2b5ac97ad8 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -38,6 +38,7 @@ export const enableRepoSnapshotLabel = window.app.pageOptions.enableRepoSnapshot export const shareLinkPasswordMinLength = window.app.pageOptions.shareLinkPasswordMinLength; export const shareLinkExpireDaysMin = window.app.pageOptions.shareLinkExpireDaysMin; export const shareLinkExpireDaysMax = window.app.pageOptions.shareLinkExpireDaysMax; +export const shareLinkExpireDaysDefault = window.app.pageOptions.shareLinkExpireDaysDefault; export const maxFileName = window.app.pageOptions.maxFileName; export const enableWiki = window.app.pageOptions.enableWiki; export const canPublishRepo = window.app.pageOptions.canPublishRepo; diff --git a/seahub/templates/base_for_react.html b/seahub/templates/base_for_react.html index 765bd722b0..9f93847e26 100644 --- a/seahub/templates/base_for_react.html +++ b/seahub/templates/base_for_react.html @@ -74,6 +74,7 @@ })(), enableRepoSnapshotLabel: {% if enable_repo_snapshot_label %} true {% else %} false {% endif %}, shareLinkPasswordMinLength: {{ share_link_password_min_length }}, + shareLinkExpireDaysDefault: {{ share_link_expire_days_default }}, shareLinkExpireDaysMin: "{{ share_link_expire_days_min }}", shareLinkExpireDaysMax: "{{ share_link_expire_days_max }}", maxFileName: "{{ max_file_name }}", diff --git a/seahub/templates/file_view_react.html b/seahub/templates/file_view_react.html index 2b23ddefbd..2a44ec8281 100644 --- a/seahub/templates/file_view_react.html +++ b/seahub/templates/file_view_react.html @@ -12,6 +12,7 @@ window.app.pageOptions = { canGenerateShareLink: {% if user.permissions.can_generate_share_link %} true {% else %} false {% endif %}, shareLinkPasswordMinLength: {{ share_link_password_min_length }}, + shareLinkExpireDaysDefault: {{ share_link_expire_days_default }}, shareLinkExpireDaysMin: {{ share_link_expire_days_min }}, shareLinkExpireDaysMax: {{ share_link_expire_days_max }}, diff --git a/seahub/templates/view_file_markdown.html b/seahub/templates/view_file_markdown.html index 673a527aab..36942c7e43 100644 --- a/seahub/templates/view_file_markdown.html +++ b/seahub/templates/view_file_markdown.html @@ -40,6 +40,7 @@ draftFilePath: '{{ draft_file_path }}', draftOriginFilePath: '{{ draft_origin_file_path }}', shareLinkPasswordMinLength: '{{ share_link_password_min_length }}', + shareLinkExpireDaysDefault: '{{ share_link_expire_days_default }}', shareLinkExpireDaysMin: '{{ share_link_expire_days_min }}', shareLinkExpireDaysMax: '{{ share_link_expire_days_max }}', canGenerateShareLink: {% if user.permissions.can_generate_share_link %} true {% else %} false {% endif %}, diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py index cd9ed7b088..8211516f1d 100644 --- a/seahub/views/__init__.py +++ b/seahub/views/__init__.py @@ -1233,6 +1233,7 @@ def react_fake_view(request, **kwargs): 'seafile_collab_server': SEAFILE_COLLAB_SERVER, 'storages': get_library_storages(request), 'enable_repo_snapshot_label': settings.ENABLE_REPO_SNAPSHOT_LABEL, + 'share_link_expire_days_default': settings.SHARE_LINK_EXPIRE_DAYS_DEFAULT, 'share_link_expire_days_min': SHARE_LINK_EXPIRE_DAYS_MIN, 'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX, 'enable_encrypted_library': config.ENABLE_ENCRYPTED_LIBRARY, diff --git a/seahub/views/file.py b/seahub/views/file.py index 60a79226da..2bbfb4ffac 100644 --- a/seahub/views/file.py +++ b/seahub/views/file.py @@ -87,7 +87,8 @@ if HAS_OFFICE_CONVERTER: import seahub.settings as settings from seahub.settings import FILE_ENCODING_LIST, FILE_PREVIEW_MAX_SIZE, \ FILE_ENCODING_TRY_LIST, MEDIA_URL, SEAFILE_COLLAB_SERVER, ENABLE_WATERMARK, \ - SHARE_LINK_EXPIRE_DAYS_MIN, SHARE_LINK_EXPIRE_DAYS_MAX, SHARE_LINK_PASSWORD_MIN_LENGTH + SHARE_LINK_EXPIRE_DAYS_MIN, SHARE_LINK_EXPIRE_DAYS_MAX, SHARE_LINK_PASSWORD_MIN_LENGTH, \ + SHARE_LINK_EXPIRE_DAYS_DEFAULT # wopi try: @@ -525,6 +526,7 @@ def view_lib_file(request, repo_id, path): 'enable_file_comment': settings.ENABLE_FILE_COMMENT, 'enable_watermark': ENABLE_WATERMARK, 'share_link_password_min_length': SHARE_LINK_PASSWORD_MIN_LENGTH, + 'share_link_expire_days_default': SHARE_LINK_EXPIRE_DAYS_DEFAULT, 'share_link_expire_days_min': SHARE_LINK_EXPIRE_DAYS_MIN, 'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX, 'can_download_file': parse_repo_perm(permission).can_download, @@ -693,6 +695,7 @@ def view_lib_file(request, repo_id, path): return_dict['draft_id'] = draft['draft_id'] return_dict['draft_file_path'] = draft['draft_file_path'] return_dict['draft_origin_file_path'] = draft['draft_origin_file_path'] + return_dict['share_link_expire_days_Default'] = SHARE_LINK_EXPIRE_DAYS_DEFAULT return_dict['share_link_expire_days_min'] = SHARE_LINK_EXPIRE_DAYS_MIN return_dict['share_link_expire_days_max'] = SHARE_LINK_EXPIRE_DAYS_MAX