Merge branch 'hotfix/v0.0.3' of github.com:ONLYOFFICE/AppServer into hotfix/v0.0.3

This commit is contained in:
Alexey Kostenko 2020-12-17 14:54:24 +03:00
commit fb2b591603
5 changed files with 49 additions and 25 deletions

View File

@ -66,7 +66,9 @@ const SimpleFilesRowContent = styled(RowContent)`
width: 14px;
margin-right: 6px;
}
.lock-file {
cursor: pointer;
}
.badges {
display: flex;
align-items: center;
@ -570,10 +572,13 @@ class FilesRowContent extends React.PureComponent {
)}
{locked && (
<Icons.FileActionsLockedIcon
className="badge"
className="badge lock-file"
size="small"
isfill={true}
color="#3B72A7"
data-id={item.id}
data-locked={true}
onClick={this.props.onClickLock}
/>
)}
{versionGroup > 1 && (

View File

@ -156,16 +156,18 @@ const SimpleFilesRow = styled(Row)`
width: 0px;
}
`}
.share-button-icon {
margin-right: 7px;
margin-top: -1px;
}
.share-button,
.share-button:hover,
.share-button-icon:hover {
cursor: pointer;
div {
color: "#657077";
color: #657077;
path {
fill: #657077;
}
}
@ -542,7 +544,7 @@ class SectionBodyContent extends React.Component {
history.push(`${settings.homepage}/${fileId}/history`);
};
lockFile = () => {
lockFile = (e) => {
const {
selection,
/*files,*/ selectedFolderId,
@ -550,9 +552,20 @@ class SectionBodyContent extends React.Component {
setIsLoading,
fetchFiles,
} = this.props;
let fileId, isLockedFile;
const file = selection[0];
api.files.lockFile(file.id, !file.locked).then((res) => {
if (file) {
fileId = file.id;
isLockedFile = !file.locked;
} else {
const { id, locked } = e.currentTarget.dataset;
fileId = Number(id);
isLockedFile = !Boolean(locked);
}
api.files.lockFile(fileId, isLockedFile).then((res) => {
/*const newFiles = files;
const indexOfFile = newFiles.findIndex(x => x.id === res.id);
newFiles[indexOfFile] = res;*/
@ -1497,7 +1510,8 @@ class SectionBodyContent extends React.Component {
});
};
getSharedButton = () => {
getSharedButton = (shared) => {
const color = shared ? "#657077" : "#a3a9ae";
return (
<Text
className="share-button"
@ -1505,13 +1519,13 @@ class SectionBodyContent extends React.Component {
title={this.props.t("Share")}
fontSize="12px"
fontWeight={600}
color="#A3A9AE"
color={color}
display="inline-flex"
onClick={this.onClickShare}
>
<IconButton
className="share-button-icon"
color="#a3a9ae"
color={color}
hoverColor="#657077"
size={18}
iconName="CatalogSharedIcon"
@ -1769,7 +1783,7 @@ class SectionBodyContent extends React.Component {
const sharedButton =
isRecycleBin || isEdit || item.id <= 0 || sectionWidth < 500
? null
: this.getSharedButton();
: this.getSharedButton(item.shared);
const displayShareButton =
sectionWidth < 500
? "26px"
@ -1816,6 +1830,7 @@ class SectionBodyContent extends React.Component {
onEditComplete={this.onEditComplete}
onMediaFileClick={this.onMediaFileClick}
onClickFavorite={this.onClickFavorite}
onClickLock={this.lockFile}
openDocEditor={this.openDocEditor}
/>
</SimpleFilesRow>

View File

@ -421,7 +421,7 @@ namespace ASC.Files.Core.Data
var entryIds = tags.Select(r => r.EntryId).ToList();
var entryTypes = tags.Select(r => (int)r.EntryType).Distinct().ToList();
var sqlQuery = Query(FilesDbContext.Tag)
var sqlQuery = Query(FilesDbContext.Tag)
.Join(FilesDbContext.TagLink, r => r.Id, l => l.TagId, (tag, link) => new TagLinkData { Tag = tag, Link = link })
.Where(r => r.Link.TenantId == r.Tag.TenantId)
.Where(r => r.Tag.Flag == TagType.New)
@ -450,7 +450,7 @@ namespace ASC.Files.Core.Data
var getBaseSqlQuery = new Func<IQueryable<TagLinkData>>(() =>
{
var fnResult = Query(FilesDbContext.Tag)
var fnResult = Query(FilesDbContext.Tag)
.Join(FilesDbContext.TagLink, r => r.Id, l => l.TagId, (tag, link) => new TagLinkData { Tag = tag, Link = link })
.Where(r => r.Link.TenantId == r.Tag.TenantId)
.Where(r => r.Tag.Flag == TagType.New)
@ -495,7 +495,8 @@ namespace ASC.Files.Core.Data
.FirstOrDefault()
})
.Where(r => r.root.FolderType == FolderType.USER)
.Select(r => r.tagLink);
.Select(r => r.tagLink)
.Distinct();
tempTags = tempTags.Concat(FromQuery(tmpShareFileTags));

View File

@ -118,8 +118,9 @@ class Form extends React.PureComponent {
window.addEventListener("keydown", this.onKeyPress);
window.addEventListener("keyup", this.onKeyPress);
if (this.props.isAuthenticated) {
api.user.logout();
logout(false);
}
}

View File

@ -147,12 +147,10 @@ export function getUser(dispatch) {
}
export function getIsAuthenticated(dispatch) {
return api.user
.checkIsAuthenticated()
.then((success) => {
dispatch(setIsAuthenticated(success));
return success;
});
return api.user.checkIsAuthenticated().then((success) => {
dispatch(setIsAuthenticated(success));
return success;
});
}
export function getPortalSettings(dispatch) {
@ -204,13 +202,17 @@ export function login(user, hash) {
};
}
export function logout() {
export function logout(needRedirect = true) {
return (dispatch) => {
return api.user.logout().then(() => {
setWithCredentialsStatus(false);
dispatch(setLogout());
if (!needRedirect) {
getPortalSettings(dispatch);
} else {
dispatch(setLogout());
history.push("/login");
history.push("/login");
}
});
};
}
@ -235,4 +237,4 @@ export function getPortalPasswordSettings(dispatch, confirmKey = null) {
export const reloadPortalSettings = () => {
return (dispatch) => getPortalSettings(dispatch);
};
};