1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 17:33:18 +00:00

Merge pull request #3309 from haiwen/fix-warnings

fix warnings
This commit is contained in:
Daniel Pan
2019-04-22 10:42:26 +08:00
committed by GitHub
18 changed files with 99 additions and 99 deletions

View File

@@ -159,7 +159,7 @@ class Account extends Component {
Account.defaultProps = {
isAdminPanel: false
}
};
Account.propTypes = propTypes;

View File

@@ -10,15 +10,15 @@ const propTypes = {
onNoticeItemClick: PropTypes.func.isRequired,
};
const MSG_TYPE_ADD_USER_TO_GROUP = 'add_user_to_group'
const MSG_TYPE_REPO_SHARE = 'repo_share'
const MSG_TYPE_REPO_SHARE_TO_GROUP = 'repo_share_to_group'
const MSG_TYPE_REPO_TRANSFER = 'repo_transfer'
const MSG_TYPE_FILE_UPLOADED = 'file_uploaded'
const MSG_TYPE_FILE_COMMENT = 'file_comment'
const MSG_TYPE_DRAFT_COMMENT = 'draft_comment'
const MSG_TYPE_DRAFT_REVIEWER = 'draft_reviewer'
const MSG_TYPE_GUEST_INVITATION_ACCEPTED = 'guest_invitation_accepted'
const MSG_TYPE_ADD_USER_TO_GROUP = 'add_user_to_group';
const MSG_TYPE_REPO_SHARE = 'repo_share';
const MSG_TYPE_REPO_SHARE_TO_GROUP = 'repo_share_to_group';
const MSG_TYPE_REPO_TRANSFER = 'repo_transfer';
const MSG_TYPE_FILE_UPLOADED = 'file_uploaded';
const MSG_TYPE_FILE_COMMENT = 'file_comment';
const MSG_TYPE_DRAFT_COMMENT = 'draft_comment';
const MSG_TYPE_DRAFT_REVIEWER = 'draft_reviewer';
const MSG_TYPE_GUEST_INVITATION_ACCEPTED = 'guest_invitation_accepted';
class NoticeItem extends React.Component {
@@ -130,7 +130,7 @@ class NoticeItem extends React.Component {
} else {
notice = gettext('A file named {upload_file_link} is uploaded to {uploaded_link}.');
notice = notice.replace('{upload_file_link}', fileName);
notice = notice.replace('{uploaded_link}', '<strong>Deleted Library</strong>')
notice = notice.replace('{uploaded_link}', '<strong>Deleted Library</strong>');
}
return {avatar_url, notice};
}
@@ -216,7 +216,7 @@ class NoticeItem extends React.Component {
<p className="time">{moment(noticeItem.time).fromNow()}</p>
</div>
</li>
)
);
}
}

View File

@@ -203,7 +203,7 @@ class ContextMenu extends React.Component {
<div role="menu" className="seafile-contextmenu dropdown-menu" style={inlineStyle} ref={menu => { this.menu = menu; }}>
{this.state.menuList.map((menuItem, index) => {
if (menuItem === 'Divider') {
return <div key={index} className="seafile-divider dropdown-divider"></div>
return <div key={index} className="seafile-divider dropdown-divider"></div>;
} else {
return (
<button

View File

@@ -7,10 +7,10 @@ class GlobalEventListener {
this.callbacks = {};
if (canUseDOM) {
window.addEventListener(MENU_SHOW, this.handleShowEvent);
window.addEventListener(MENU_HIDE, this.handleHideEvent);
window.addEventListener(MENU_SHOW, this.handleShowEvent);
window.addEventListener(MENU_HIDE, this.handleHideEvent);
}
}
}
handleShowEvent = (event) => {
for (const id in this.callbacks) {

View File

@@ -157,7 +157,7 @@ class CopyDirent extends React.Component {
} else {
title = gettext('Copy selected item(s) to:');
}
let mode = this.props.repoEncrypted ? 'only_current_library':'current_repo_and_other_repos'
let mode = this.props.repoEncrypted ? 'only_current_library':'current_repo_and_other_repos';
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}><div dangerouslySetInnerHTML={{__html: title}}></div></ModalHeader>

View File

@@ -130,8 +130,8 @@ class LibHistorySetting extends React.Component {
</Form>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.props.toggleDialog}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.submit}>{gettext('Submit')}</Button>
<Button color="secondary" onClick={this.props.toggleDialog}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.submit}>{gettext('Submit')}</Button>
</ModalFooter>
</Modal>
);

View File

@@ -36,7 +36,7 @@ class ListCreatedFileDialog extends React.Component {
if (item.name.endsWith('(draft).md')) {
fileURL = serviceURL + '/drafts/' + item.draft_id + '/';
}
let fileLink = <a href={fileURL} target='_blank'>{item.name}</a>
let fileLink = <a href={fileURL} target='_blank'>{item.name}</a>;
if (item.name.endsWith('(draft).md') && !item.draft_id) {
fileLink = item.name;
}

View File

@@ -127,7 +127,7 @@ class TaggedFile extends React.Component {
return ( taggedFile.file_deleted ?
<tr onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
<td colSpan='3' className="name">{taggedFile.filename}{' '}
<span style={{color:"red"}}>{gettext('deleted')}</span>
<span style={{color:'red'}}>{gettext('deleted')}</span>
</td>
<td><i className={className} onClick={this.props.onDeleteTaggedFile.bind(this, taggedFile)}></i></td>
</tr>

View File

@@ -157,7 +157,7 @@ class MoveDirent extends React.Component {
} else {
title = gettext('Move selected item(s) to:');
}
let mode = this.props.repoEncrypted ? 'only_current_library':'current_repo_and_other_repos'
let mode = this.props.repoEncrypted ? 'only_current_library':'current_repo_and_other_repos';
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}><div dangerouslySetInnerHTML={{__html: title}}></div></ModalHeader>

View File

@@ -140,18 +140,18 @@ class DetailListView extends React.Component {
</tbody>
</table>
{this.state.showRelatedFileDialog &&
<ModalPortal>
<RelatedFileDialogs
repoID={this.props.repoID}
filePath={direntPath}
relatedFiles={relatedFiles}
toggleCancel={this.toggleCancel}
onRelatedFileChange={this.onRelatedFileChange}
dirent={this.props.dirent}
viewMode="list_related_file"
/>
</ModalPortal>
}
<ModalPortal>
<RelatedFileDialogs
repoID={this.props.repoID}
filePath={direntPath}
relatedFiles={relatedFiles}
toggleCancel={this.toggleCancel}
onRelatedFileChange={this.onRelatedFileChange}
dirent={this.props.dirent}
viewMode="list_related_file"
/>
</ModalPortal>
}
{
this.state.isEditFileTagShow &&
<EditFileTagDialog

View File

@@ -332,24 +332,24 @@ class FileChooser extends React.Component {
</Fragment>
)}
{this.props.mode === 'only_current_library' && (
<div className="list-view">
<div className="list-view-header">
<span className={`item-toggle fa ${this.state.isCurrentRepoShow ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onCurrentRepoToggle}></span>
<span className="library">{gettext('Current Library')}</span>
</div>
{
this.state.isCurrentRepoShow && this.state.currentRepoInfo &&
<RepoListView
initToShowChildren={true}
currentRepoInfo={this.state.currentRepoInfo}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
/>
}
<div className="list-view">
<div className="list-view-header">
<span className={`item-toggle fa ${this.state.isCurrentRepoShow ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onCurrentRepoToggle}></span>
<span className="library">{gettext('Current Library')}</span>
</div>
{
this.state.isCurrentRepoShow && this.state.currentRepoInfo &&
<RepoListView
initToShowChildren={true}
currentRepoInfo={this.state.currentRepoInfo}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
/>
}
</div>
)}
{this.props.mode === 'only_all_repos' && (
<div className="file-chooser-container">
@@ -358,15 +358,15 @@ class FileChooser extends React.Component {
<span className="item-toggle fa fa-caret-down"></span>
<span className="library">{gettext('Libraries')}</span>
</div>
<RepoListView
initToShowChildren={false}
repoList={this.state.repoList}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
/>
<RepoListView
initToShowChildren={false}
repoList={this.state.repoList}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
/>
</div>
</div>
)}

View File

@@ -16,7 +16,7 @@ class SearchResultItem extends React.Component {
render() {
let item = this.props.item;
let className = item.link_content ? "item-img" : "lib-item-img";
let className = item.link_content ? 'item-img' : 'lib-item-img';
let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(true);
let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name, 192);
return (

View File

@@ -40,31 +40,31 @@ class RepoViewToolbar extends React.Component {
render() {
return (
<Fragment>
<div className="cur-view-toolbar">
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.props.onShowSidePanel}></span>
<MediaQuery query="(min-width: 768px)">
<div className="operation">
<button className="btn btn-secondary operation-item" title={gettext('New Library')} onClick={this.onCreateToggle}>
<i className="fas fa-plus-square text-secondary mr-1"></i>{gettext('New Library')}
</button>
{this.props.libraryType !== 'group' && (
<Dropdown isOpen={this.state.isOpen} toggle={this.toggleMore}>
<DropdownToggle className='btn btn-secondary operation-item'>
{gettext('More')}
</DropdownToggle>
<DropdownMenu>
<DropdownItem className="link-dropdown-container">
<Link className="link-dropdown-item" to={siteRoot + 'my-libs/deleted/'}>{gettext('Deleted Libraries')}</Link>
</DropdownItem>
</DropdownMenu>
</Dropdown>
)}
</div>
</MediaQuery>
<MediaQuery query="(max-width: 768px)">
<span className="sf2-icon-plus mobile-toolbar-icon" title={gettext('New Library')} onClick={this.onCreateToggle}></span>
</MediaQuery>
</div>
<div className="cur-view-toolbar">
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.props.onShowSidePanel}></span>
<MediaQuery query="(min-width: 768px)">
<div className="operation">
<button className="btn btn-secondary operation-item" title={gettext('New Library')} onClick={this.onCreateToggle}>
<i className="fas fa-plus-square text-secondary mr-1"></i>{gettext('New Library')}
</button>
{this.props.libraryType !== 'group' && (
<Dropdown isOpen={this.state.isOpen} toggle={this.toggleMore}>
<DropdownToggle className='btn btn-secondary operation-item'>
{gettext('More')}
</DropdownToggle>
<DropdownMenu>
<DropdownItem className="link-dropdown-container">
<Link className="link-dropdown-item" to={siteRoot + 'my-libs/deleted/'}>{gettext('Deleted Libraries')}</Link>
</DropdownItem>
</DropdownMenu>
</Dropdown>
)}
</div>
</MediaQuery>
<MediaQuery query="(max-width: 768px)">
<span className="sf2-icon-plus mobile-toolbar-icon" title={gettext('New Library')} onClick={this.onCreateToggle}></span>
</MediaQuery>
</div>
{this.state.isCreateRepoDialogShow && (
<ModalPortal>
<CreateRepoDialog

View File

@@ -426,7 +426,7 @@ class Draft extends React.Component {
seafileAPI.publishDraft(draftID).then(res => {
this.setState({
freezePublish: !this.state.freezePublish
})
});
});
}

View File

@@ -109,7 +109,7 @@ class MylibRepoListItem extends React.Component {
} else {
seafileAPI.starItem(this.props.repo.repo_id, '/').then(() => {
this.setState({isStarred: !this.state.isStarred});
})
});
}
}
@@ -252,7 +252,7 @@ class MylibRepoListItem extends React.Component {
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} onClick={this.onRepoClick}>
<td><img src={iconUrl} title={iconTitle} alt={iconTitle} width="24" /></td>
<td>
{this.state.isRenaming && (
{this.state.isRenaming && (
<Rename
name={repo.repo_name}
onRenameConfirm={this.onRenameConfirm}
@@ -351,7 +351,7 @@ class MylibRepoListItem extends React.Component {
</ModalPortal>
)}
</Fragment>
)
);
}
}

View File

@@ -61,7 +61,7 @@ class TableBody extends Component {
getThumbnails() {
let items = this.state.items.filter((item) => {
return Utils.imageCheck(item.obj_name) && !item.repo_encrypted;
return Utils.imageCheck(item.obj_name) && !item.repo_encrypted;
});
if (items.length == 0) {
return ;
@@ -175,8 +175,8 @@ class Item extends Component {
</td>
<td>
{ data.is_dir ?
<Link to={data.dirent_view_url}>{data.obj_name}</Link> :
<a className="normal" href={data.dirent_view_url} target="_blank">{data.obj_name}</a>
<Link to={data.dirent_view_url}>{data.obj_name}</Link> :
<a className="normal" href={data.dirent_view_url} target="_blank">{data.obj_name}</a>
}
</td>
<td>{data.repo_name}</td>
@@ -198,8 +198,8 @@ class Item extends Component {
</td>
<td>
{ data.is_dir ?
<Link to={data.dirent_view_url}>{data.obj_name}</Link> :
<a className="normal" href={data.dirent_view_url} target="_blank">{data.obj_name}</a>
<Link to={data.dirent_view_url}>{data.obj_name}</Link> :
<a className="normal" href={data.dirent_view_url} target="_blank">{data.obj_name}</a>
}
<br />
<span className="dirent-meta-info">{data.repo_name}</span>

View File

@@ -123,9 +123,9 @@ class Wikis extends Component {
<div className="cur-view-toolbar">
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.props.onShowSidePanel}></span>
<div className="operation">
<Button className="btn btn-secondary operation-item" onClick={this.onSelectToggle}>
<i className="fa fa-plus-square text-secondary mr-1"></i>{gettext('Publish a Library')}
</Button>
<Button className="btn btn-secondary operation-item" onClick={this.onSelectToggle}>
<i className="fa fa-plus-square text-secondary mr-1"></i>{gettext('Publish a Library')}
</Button>
</div>
</div>
<CommonToolbar onSearchedClick={this.props.onSearchedClick} />

View File

@@ -1025,7 +1025,7 @@ class Wiki extends Component {
if (!repoEncrypted && (
canGenerateShareLink || canGenerateUploadLink ||
isRepoOwner || isAdmin) && (
userPerm == 'rw' || userPerm == 'r')) {
userPerm == 'rw' || userPerm == 'r')) {
showShareBtn = true;
if (!isVirtual && (isRepoOwner || isAdmin || isDepartmentAdmin)) {
enableDirPrivateShare = true;