1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 01:41:39 +00:00

repair grid-item locked bug

This commit is contained in:
shanshuirenjia
2019-04-23 10:49:07 +08:00
parent 32b7234051
commit 4c37bc0363
2 changed files with 7 additions and 1 deletions

View File

@@ -144,6 +144,9 @@ class DirentGridItem extends React.Component {
gridClass += this.state.isGridSelected ? " grid-selected-active" : " ";
gridClass += this.state.isGridDropTipShow ? " grid-drop-show" : " ";
let lockedInfo = gettext('locked by {name}');
lockedInfo = lockedInfo.replace('{name}', dirent.lock_owner_name);
return(
<Fragment>
<li className="grid-item" onContextMenu={this.onGridItemContextMenu} onMouseDown={this.onGridItemMouseDown}>
@@ -161,7 +164,7 @@ class DirentGridItem extends React.Component {
<img src={`${siteRoot}${fileUrl}`} ref={this.gridIcon} className="thumbnail" onClick={this.onItemClick} alt=""/> :
<img src={iconUrl} ref={this.gridIcon} width="96" alt='' />
}
{dirent.is_locked && <img className="grid-file-locked-icon" src={mediaUrl + 'img/file-locked-32.png'} alt={gettext('locked')} title={dirent.lock_owner_name}/>}
{dirent.is_locked && <img className="grid-file-locked-icon" src={mediaUrl + 'img/file-locked-32.png'} alt={gettext('locked')} title={lockedInfo}/>}
</div>
<div className="grid-file-name" onDragStart={this.onGridItemDragStart} draggable="true" >
<a className={`grid-file-name-link ${this.state.isGridSelected ? "grid-link-selected-active" : ""}`} href={dirent.type === 'dir' ? dirHref : fileHref} onClick={this.onItemLinkClick}>{dirent.name}</a>

View File

@@ -225,6 +225,8 @@ class DirentGridView extends React.Component{
seafileAPI.lockfile(repoID, filePath).then(() => {
this.props.updateDirent(currentObject, 'is_locked', true);
this.props.updateDirent(currentObject, 'locked_by_me', true);
let lockName = username.split('@');
this.props.updateDirent(currentObject, 'lock_owner_name', lockName[0]);
});
}
@@ -234,6 +236,7 @@ class DirentGridView extends React.Component{
seafileAPI.unlockfile(repoID, filePath).then(() => {
this.props.updateDirent(currentObject, 'is_locked', false);
this.props.updateDirent(currentObject, 'locked_by_me', false);
this.props.updateDirent(currentObject, 'lock_owner_name', '');
});
}