Merge branch 'develop' of github.com:ONLYOFFICE/DocSpace into develop
This commit is contained in:
commit
83d84be867
@ -124,7 +124,6 @@ const ArticleMainButtonContent = (props) => {
|
||||
);
|
||||
|
||||
const onCreateRoom = React.useCallback(() => {
|
||||
console.log("click");
|
||||
const event = new Event(Events.ROOM_CREATE);
|
||||
window.dispatchEvent(event);
|
||||
}, []);
|
||||
|
@ -23,6 +23,10 @@ const CreateRoomEvent = ({
|
||||
|
||||
currrentFolderId,
|
||||
updateCurrentFolder,
|
||||
|
||||
withPaging,
|
||||
addFile,
|
||||
setCreateRoomDialogVisible,
|
||||
}) => {
|
||||
const { t } = useTranslation(["CreateEditRoomDialog", "Common", "Files"]);
|
||||
const [fetchedTags, setFetchedTags] = useState([]);
|
||||
@ -50,7 +54,7 @@ const CreateRoomEvent = ({
|
||||
setIsLoading(true);
|
||||
|
||||
// create room
|
||||
const room =
|
||||
let room =
|
||||
isThirdparty && storageFolderId
|
||||
? await createRoomInThirdpary(storageFolderId, createRoomData)
|
||||
: await createRoom(createRoomData);
|
||||
@ -64,7 +68,7 @@ const CreateRoomEvent = ({
|
||||
await createTag(createTagsData[i]);
|
||||
|
||||
// add new tags to room
|
||||
await addTagsToRoom(room.id, addTagsData);
|
||||
room = await addTagsToRoom(room.id, addTagsData);
|
||||
|
||||
// calculate and upload logo to room
|
||||
if (roomParams.icon.uploadedFile)
|
||||
@ -73,19 +77,26 @@ const CreateRoomEvent = ({
|
||||
const img = new Image();
|
||||
img.onload = async () => {
|
||||
const { x, y, zoom } = roomParams.icon;
|
||||
await addLogoToRoom(room.id, {
|
||||
room = await addLogoToRoom(room.id, {
|
||||
tmpFile: response.data,
|
||||
...calculateRoomLogoParams(img, x, y, zoom),
|
||||
});
|
||||
|
||||
!withPaging && addFile(room, true);
|
||||
|
||||
URL.revokeObjectURL(img.src);
|
||||
};
|
||||
img.src = url;
|
||||
});
|
||||
else !withPaging && addFile(room, true);
|
||||
} catch (err) {
|
||||
toastr.error(err);
|
||||
console.log(err);
|
||||
} finally {
|
||||
await updateCurrentFolder(null, currrentFolderId);
|
||||
if (withPaging) {
|
||||
await updateCurrentFolder(null, currrentFolderId);
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
onClose();
|
||||
}
|
||||
@ -96,6 +107,12 @@ const CreateRoomEvent = ({
|
||||
setFetchedTags(tags);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setCreateRoomDialogVisible(true);
|
||||
|
||||
return () => setCreateRoomDialogVisible(false);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<CreateRoomDialog
|
||||
t={t}
|
||||
@ -113,6 +130,7 @@ const CreateRoomEvent = ({
|
||||
|
||||
export default inject(
|
||||
({
|
||||
auth,
|
||||
filesStore,
|
||||
tagsStore,
|
||||
filesActionsStore,
|
||||
@ -127,18 +145,20 @@ export default inject(
|
||||
calculateRoomLogoParams,
|
||||
uploadRoomLogo,
|
||||
addLogoToRoom,
|
||||
addFile,
|
||||
} = filesStore;
|
||||
const { createTag, fetchTags } = tagsStore;
|
||||
|
||||
const { id: currrentFolderId } = selectedFolderStore;
|
||||
const { updateCurrentFolder } = filesActionsStore;
|
||||
|
||||
const { connectDialogVisible } = dialogsStore;
|
||||
const { connectDialogVisible, setCreateRoomDialogVisible } = dialogsStore;
|
||||
|
||||
const {
|
||||
deleteThirdParty,
|
||||
fetchThirdPartyProviders,
|
||||
} = settingsStore.thirdPartyStore;
|
||||
const { withPaging } = auth.settingsStore;
|
||||
|
||||
return {
|
||||
createRoom,
|
||||
@ -155,6 +175,10 @@ export default inject(
|
||||
connectDialogVisible,
|
||||
currrentFolderId,
|
||||
updateCurrentFolder,
|
||||
|
||||
withPaging,
|
||||
addFile,
|
||||
setCreateRoomDialogVisible,
|
||||
};
|
||||
}
|
||||
)(observer(CreateRoomEvent));
|
||||
|
@ -26,6 +26,9 @@ const EditRoomEvent = ({
|
||||
|
||||
currentFolderId,
|
||||
updateCurrentFolder,
|
||||
setCreateRoomDialogVisible,
|
||||
|
||||
withPaging,
|
||||
}) => {
|
||||
const { t } = useTranslation(["CreateEditRoomDialog", "Common", "Files"]);
|
||||
|
||||
@ -72,14 +75,14 @@ const EditRoomEvent = ({
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
const room = await editRoom(item.id, editRoomParams);
|
||||
let room = await editRoom(item.id, editRoomParams);
|
||||
|
||||
for (let i = 0; i < newTags.length; i++) await createTag(newTags[i]);
|
||||
await addTagsToRoom(room.id, tags);
|
||||
await removeTagsFromRoom(room.id, removedTags);
|
||||
room = await addTagsToRoom(room.id, tags);
|
||||
room = await removeTagsFromRoom(room.id, removedTags);
|
||||
|
||||
if (!!item.logo.original && !roomParams.icon.uploadedFile)
|
||||
await removeLogoFromRoom(room.id);
|
||||
room = await removeLogoFromRoom(room.id);
|
||||
|
||||
if (roomParams.icon.uploadedFile) {
|
||||
await setFolder({
|
||||
@ -91,19 +94,24 @@ const EditRoomEvent = ({
|
||||
const img = new Image();
|
||||
img.onload = async () => {
|
||||
const { x, y, zoom } = roomParams.icon;
|
||||
await addLogoToRoom(room.id, {
|
||||
room = await addLogoToRoom(room.id, {
|
||||
tmpFile: response.data,
|
||||
...calculateRoomLogoParams(img, x, y, zoom),
|
||||
});
|
||||
|
||||
!withPaging && setFolder(room);
|
||||
|
||||
URL.revokeObjectURL(img.src);
|
||||
};
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
} else !withPaging && setFolder(room);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
} finally {
|
||||
await updateCurrentFolder(null, currentFolderId);
|
||||
if (withPaging) {
|
||||
await updateCurrentFolder(null, currentFolderId);
|
||||
}
|
||||
setIsLoading(false);
|
||||
onClose();
|
||||
}
|
||||
@ -129,6 +137,12 @@ const EditRoomEvent = ({
|
||||
setFetchedTags(tags);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setCreateRoomDialogVisible(true);
|
||||
|
||||
return () => setCreateRoomDialogVisible(false);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<EditRoomDialog
|
||||
t={t}
|
||||
@ -145,10 +159,12 @@ const EditRoomEvent = ({
|
||||
|
||||
export default inject(
|
||||
({
|
||||
auth,
|
||||
filesStore,
|
||||
tagsStore,
|
||||
filesActionsStore,
|
||||
selectedFolderStore,
|
||||
dialogsStore,
|
||||
settingsStore,
|
||||
}) => {
|
||||
const {
|
||||
@ -166,6 +182,8 @@ export default inject(
|
||||
const { id: currentFolderId } = selectedFolderStore;
|
||||
const { updateCurrentFolder } = filesActionsStore;
|
||||
const { getThirdPartyIcon } = settingsStore.thirdPartyStore;
|
||||
const { setCreateRoomDialogVisible } = dialogsStore;
|
||||
const { withPaging } = auth.settingsStore;
|
||||
|
||||
return {
|
||||
editRoom,
|
||||
@ -185,6 +203,9 @@ export default inject(
|
||||
|
||||
currentFolderId,
|
||||
updateCurrentFolder,
|
||||
|
||||
withPaging,
|
||||
setCreateRoomDialogVisible,
|
||||
};
|
||||
}
|
||||
)(observer(EditRoomEvent));
|
||||
|
@ -45,6 +45,13 @@ const StyledDropDown = styled(DropDown)`
|
||||
font-weight: 400;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
|
||||
display: block;
|
||||
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
&:hover {
|
||||
background: ${(props) =>
|
||||
props.theme.createEditRoomDialog.dropdown.item.hoverBackground};
|
||||
|
@ -609,6 +609,7 @@ class SectionHeaderContent extends React.Component {
|
||||
isEmptyPage,
|
||||
canCreateFiles,
|
||||
} = this.props;
|
||||
|
||||
const menuItems = this.getMenuItems();
|
||||
const isLoading = !title || !tReady;
|
||||
const headerMenu = getHeaderMenu(t);
|
||||
@ -636,7 +637,7 @@ class SectionHeaderContent extends React.Component {
|
||||
sectionWidth={context.sectionWidth}
|
||||
showText={showText}
|
||||
isRootFolder={isRootFolder}
|
||||
canCreate={canCreate && canCreateFiles}
|
||||
canCreate={canCreate && (canCreateFiles || isRoomsFolder)}
|
||||
title={title}
|
||||
isDesktop={isDesktop}
|
||||
isTabletView={isTabletView}
|
||||
|
@ -56,6 +56,7 @@ class DialogsStore {
|
||||
restoreAllArchive = false;
|
||||
isConnectDialogReconnect = false;
|
||||
saveAfterReconnectOAuth = false;
|
||||
createRoomDialogVisible = false;
|
||||
|
||||
constructor(
|
||||
authStore,
|
||||
@ -306,6 +307,10 @@ class DialogsStore {
|
||||
this.inviteUsersWarningDialogVisible = inviteUsersWarningDialogVisible;
|
||||
};
|
||||
|
||||
setCreateRoomDialogVisible = (createRoomDialogVisible) => {
|
||||
this.createRoomDialogVisible = createRoomDialogVisible;
|
||||
};
|
||||
|
||||
get someDialogIsOpen() {
|
||||
return (
|
||||
this.sharingPanelVisible ||
|
||||
@ -329,7 +334,8 @@ class DialogsStore {
|
||||
this.invitePanelOptions.visible ||
|
||||
this.archiveDialogVisible ||
|
||||
this.restoreAllPanelVisible ||
|
||||
this.inviteUsersWarningDialogVisible
|
||||
this.inviteUsersWarningDialogVisible ||
|
||||
this.createRoomDialogVisible
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -900,7 +900,7 @@ class FilesStore {
|
||||
|
||||
runInAction(() => {
|
||||
this.setFolders(data.folders);
|
||||
this.setFiles(data.files);
|
||||
this.setFiles([]);
|
||||
});
|
||||
|
||||
if (clearFilter) {
|
||||
@ -1733,9 +1733,15 @@ class FilesStore {
|
||||
};
|
||||
|
||||
addFile = (item, isFolder) => {
|
||||
const filter = this.filter.clone();
|
||||
const { isRoomsFolder, isArchiveFolder } = this.treeFoldersStore;
|
||||
|
||||
const isRooms = isRoomsFolder || isArchiveFolder;
|
||||
|
||||
const filter = isRooms ? this.roomsFilter.clone() : this.filter.clone();
|
||||
filter.total += 1;
|
||||
this.setFilter(filter);
|
||||
|
||||
if (isRooms) this.setRoomsFilter(filter);
|
||||
else this.setFilter(filter);
|
||||
|
||||
isFolder ? this.folders.unshift(item) : this.files.unshift(item);
|
||||
|
||||
@ -2652,18 +2658,8 @@ class FilesStore {
|
||||
const { isRoomsFolder, isArchiveFolder } = this.treeFoldersStore;
|
||||
|
||||
const isRooms = isRoomsFolder || isArchiveFolder;
|
||||
|
||||
// const filterTotal = isRoom ? this.roomsFilterTotal : this.filterTotal;
|
||||
const filterTotal = isRooms ? this.roomsFilter.total : this.filter.total;
|
||||
|
||||
// console.log("hasMoreFiles isRooms", isRooms);
|
||||
// console.log("hasMoreFiles filesList", this.filesList.length);
|
||||
// console.log("hasMoreFiles this.filterTotal", this.filterTotal);
|
||||
// console.log("hasMoreFiles this.roomsFilterTotal", this.roomsFilterTotal);
|
||||
// console.log("hasMoreFiles filterTotal", filterTotal);
|
||||
// console.log("hasMoreFiles", this.filesList.length < filterTotal);
|
||||
// console.log("----------------------------");
|
||||
|
||||
if (this.isLoading) return false;
|
||||
return this.filesList.length < filterTotal;
|
||||
}
|
||||
|
@ -408,11 +408,17 @@ public class PortalController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
[AllowNotPayment]
|
||||
[HttpPost("suspend")]
|
||||
public void SendSuspendInstructions()
|
||||
{
|
||||
_permissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
if (_securityContext.CurrentAccount.ID != Tenant.OwnerId)
|
||||
{
|
||||
throw new Exception(Resource.ErrorAccessDenied);
|
||||
}
|
||||
|
||||
var owner = _userManager.GetUsers(Tenant.OwnerId);
|
||||
var suspendUrl = _commonLinkUtility.GetConfirmationEmailUrl(owner.Email, ConfirmType.PortalSuspend);
|
||||
var continueUrl = _commonLinkUtility.GetConfirmationEmailUrl(owner.Email, ConfirmType.PortalContinue);
|
||||
@ -422,10 +428,17 @@ public class PortalController : ControllerBase
|
||||
_messageService.Send(MessageAction.OwnerSentPortalDeactivationInstructions, _messageTarget.Create(owner.Id), owner.DisplayUserName(false, _displayUserSettingsHelper));
|
||||
}
|
||||
|
||||
[AllowNotPayment]
|
||||
[HttpPost("delete")]
|
||||
public void SendDeleteInstructions()
|
||||
{
|
||||
_permissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
if (_securityContext.CurrentAccount.ID != Tenant.OwnerId)
|
||||
{
|
||||
throw new Exception(Resource.ErrorAccessDenied);
|
||||
}
|
||||
|
||||
var owner = _userManager.GetUsers(Tenant.OwnerId);
|
||||
|
||||
var showAutoRenewText = !_coreBaseSettings.Standalone &&
|
||||
@ -455,10 +468,16 @@ public class PortalController : ControllerBase
|
||||
_messageService.Send(MessageAction.PortalDeactivated);
|
||||
}
|
||||
|
||||
[AllowNotPayment]
|
||||
[HttpDelete("delete")]
|
||||
[Authorize(AuthenticationSchemes = "confirm", Roles = "PortalRemove")]
|
||||
public async Task<object> DeletePortal()
|
||||
{
|
||||
if (_securityContext.CurrentAccount.ID != Tenant.OwnerId)
|
||||
{
|
||||
throw new Exception(Resource.ErrorAccessDenied);
|
||||
}
|
||||
|
||||
_tenantManager.RemoveTenant(Tenant.Id);
|
||||
|
||||
if (!string.IsNullOrEmpty(_apiSystemHelper.ApiCacheUrl))
|
||||
|
Loading…
Reference in New Issue
Block a user