Merge pull request #165 from ONLYOFFICE/bugfix/info-panel-members
Web: Files: InfoPanel: fixed members list
This commit is contained in:
commit
f89a528e6d
@ -46,6 +46,7 @@ const EditRoomEvent = ({
|
||||
|
||||
reloadInfoPanelSelection,
|
||||
changeRoomOwner,
|
||||
reloadSelectionParentRoom,
|
||||
}) => {
|
||||
const { t } = useTranslation(["CreateEditRoomDialog", "Common", "Files"]);
|
||||
|
||||
@ -153,7 +154,7 @@ const EditRoomEvent = ({
|
||||
}
|
||||
|
||||
!withPaging && updateRoom(item, room);
|
||||
|
||||
reloadSelectionParentRoom();
|
||||
reloadInfoPanelSelection();
|
||||
URL.revokeObjectURL(img.src);
|
||||
setActiveFolders([]);
|
||||
@ -179,6 +180,7 @@ const EditRoomEvent = ({
|
||||
updateLogoPathsCacheBreaker();
|
||||
}
|
||||
|
||||
reloadSelectionParentRoom();
|
||||
setIsLoading(false);
|
||||
onClose();
|
||||
}
|
||||
@ -270,7 +272,10 @@ export default inject(
|
||||
const { getThirdPartyIcon } = settingsStore.thirdPartyStore;
|
||||
const { setCreateRoomDialogVisible } = dialogsStore;
|
||||
const { withPaging } = auth.settingsStore;
|
||||
const { reloadSelection: reloadInfoPanelSelection } = auth.infoPanelStore;
|
||||
const {
|
||||
reloadSelection: reloadInfoPanelSelection,
|
||||
reloadSelectionParentRoom,
|
||||
} = auth.infoPanelStore;
|
||||
return {
|
||||
addActiveItems,
|
||||
setActiveFolders,
|
||||
@ -305,6 +310,7 @@ export default inject(
|
||||
|
||||
reloadInfoPanelSelection,
|
||||
changeRoomOwner,
|
||||
reloadSelectionParentRoom,
|
||||
};
|
||||
}
|
||||
)(observer(EditRoomEvent));
|
||||
|
@ -22,12 +22,16 @@ const RoomsContextBtn = ({
|
||||
|
||||
getItemContextOptionsKeys,
|
||||
getItemContextOptionsActions,
|
||||
|
||||
onSelectItem,
|
||||
}) => {
|
||||
const contextMenuRef = useRef();
|
||||
|
||||
if (!selection) return null;
|
||||
|
||||
const onContextMenu = (e) => {
|
||||
onSelectItem();
|
||||
|
||||
if (!contextMenuRef?.current.menuRef.current)
|
||||
itemTitleRef?.current.click(e);
|
||||
contextMenuRef?.current.show(e);
|
||||
@ -71,9 +75,9 @@ const RoomsContextBtn = ({
|
||||
return options;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
contextMenuRef?.current.hide();
|
||||
}, [selection]);
|
||||
// useEffect(() => {
|
||||
// contextMenuRef?.current.hide();
|
||||
// }, [selection]);
|
||||
|
||||
return (
|
||||
<StyledItemContextOptions>
|
||||
|
@ -20,6 +20,8 @@ const RoomsItemHeader = ({
|
||||
setInviteUsersWarningDialogVisible,
|
||||
isPublicRoomType,
|
||||
roomsView,
|
||||
setSelected,
|
||||
setBufferSelection,
|
||||
}) => {
|
||||
const itemTitleRef = useRef();
|
||||
|
||||
@ -32,6 +34,11 @@ const RoomsItemHeader = ({
|
||||
const canInviteUserInRoomAbility = security?.EditAccess;
|
||||
const showInviteUserIcon = selection?.isRoom && roomsView === "info_members";
|
||||
|
||||
const onSelectItem = () => {
|
||||
setSelected("none");
|
||||
setBufferSelection(selection);
|
||||
};
|
||||
|
||||
const onClickInviteUsers = () => {
|
||||
setIsMobileHidden(true);
|
||||
const parentRoomId = selectionParentRoom.id;
|
||||
@ -84,51 +91,60 @@ const RoomsItemHeader = ({
|
||||
/>
|
||||
)}
|
||||
|
||||
<RoomsContextBtn selection={selection} itemTitleRef={itemTitleRef} />
|
||||
<RoomsContextBtn
|
||||
selection={selection}
|
||||
itemTitleRef={itemTitleRef}
|
||||
onSelectItem={onSelectItem}
|
||||
/>
|
||||
</div>
|
||||
</StyledTitle>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ auth, dialogsStore, selectedFolderStore }) => {
|
||||
const {
|
||||
selection: selectionItem,
|
||||
selectionParentRoom,
|
||||
getIsRooms,
|
||||
roomsView,
|
||||
} = auth.infoPanelStore;
|
||||
export default inject(
|
||||
({ auth, dialogsStore, selectedFolderStore, filesStore }) => {
|
||||
const {
|
||||
selection: selectionItem,
|
||||
selectionParentRoom,
|
||||
getIsRooms,
|
||||
roomsView,
|
||||
} = auth.infoPanelStore;
|
||||
|
||||
const isShowParentRoom =
|
||||
getIsRooms() &&
|
||||
roomsView === "info_members" &&
|
||||
!selectionItem.isRoom &&
|
||||
!!selectionParentRoom;
|
||||
const isShowParentRoom =
|
||||
getIsRooms() &&
|
||||
roomsView === "info_members" &&
|
||||
!selectionItem.isRoom &&
|
||||
!!selectionParentRoom;
|
||||
|
||||
const selection =
|
||||
selectionItem.length > 1
|
||||
? null
|
||||
: isShowParentRoom
|
||||
? selectionParentRoom
|
||||
: selectionItem;
|
||||
const selection =
|
||||
selectionItem.length > 1
|
||||
? null
|
||||
: isShowParentRoom
|
||||
? selectionParentRoom
|
||||
: selectionItem;
|
||||
|
||||
return {
|
||||
selection,
|
||||
roomsView,
|
||||
selectionParentRoom: auth.infoPanelStore.selectionParentRoom,
|
||||
setIsMobileHidden: auth.infoPanelStore.setIsMobileHidden,
|
||||
return {
|
||||
selection,
|
||||
roomsView,
|
||||
selectionParentRoom: auth.infoPanelStore.selectionParentRoom,
|
||||
setIsMobileHidden: auth.infoPanelStore.setIsMobileHidden,
|
||||
|
||||
isGracePeriod: auth.currentTariffStatusStore.isGracePeriod,
|
||||
isGracePeriod: auth.currentTariffStatusStore.isGracePeriod,
|
||||
|
||||
setInvitePanelOptions: dialogsStore.setInvitePanelOptions,
|
||||
setInviteUsersWarningDialogVisible:
|
||||
dialogsStore.setInviteUsersWarningDialogVisible,
|
||||
setInvitePanelOptions: dialogsStore.setInvitePanelOptions,
|
||||
setInviteUsersWarningDialogVisible:
|
||||
dialogsStore.setInviteUsersWarningDialogVisible,
|
||||
|
||||
isPublicRoomType:
|
||||
(selectedFolderStore.roomType ??
|
||||
auth.infoPanelStore.selectionParentRoom?.roomType) ===
|
||||
RoomsType.PublicRoom,
|
||||
};
|
||||
})(
|
||||
isPublicRoomType:
|
||||
(selectedFolderStore.roomType ??
|
||||
auth.infoPanelStore.selectionParentRoom?.roomType) ===
|
||||
RoomsType.PublicRoom,
|
||||
|
||||
setSelected: filesStore.setSelected,
|
||||
setBufferSelection: filesStore.setBufferSelection,
|
||||
};
|
||||
}
|
||||
)(
|
||||
withTranslation([
|
||||
"Files",
|
||||
"Common",
|
||||
|
@ -164,7 +164,7 @@ const Members = ({
|
||||
};
|
||||
|
||||
const updateSelectionParentRoomActionSelection = useCallback(async () => {
|
||||
if (!selection.isRoom || selection.id === members?.roomId) return;
|
||||
if (!selection?.isRoom || selection.id === members?.roomId) return;
|
||||
|
||||
const fetchedMembers = await fetchMembers(selection.id);
|
||||
setMembersList(fetchedMembers);
|
||||
@ -453,6 +453,8 @@ export default inject(
|
||||
setIsScrollLocked,
|
||||
membersList,
|
||||
setMembersList,
|
||||
selection: selectionItem,
|
||||
getIsRooms,
|
||||
} = auth.infoPanelStore;
|
||||
const {
|
||||
getRoomMembers,
|
||||
@ -497,9 +499,23 @@ export default inject(
|
||||
room?.access === ShareAccessRights.RoomManager ||
|
||||
room?.access === ShareAccessRights.None;
|
||||
|
||||
const isShowParentRoom =
|
||||
getIsRooms() &&
|
||||
roomsView === "info_members" &&
|
||||
!selectionItem?.isRoom &&
|
||||
!!selectionParentRoom;
|
||||
|
||||
const infoSelection =
|
||||
selectionItem?.length > 1
|
||||
? null
|
||||
: isShowParentRoom
|
||||
? selectionParentRoom
|
||||
: selectionItem;
|
||||
|
||||
return {
|
||||
setView,
|
||||
roomsView,
|
||||
selection: infoSelection,
|
||||
selectionParentRoom,
|
||||
setSelectionParentRoom,
|
||||
|
||||
|
@ -480,10 +480,9 @@ const SectionHeaderContent = (props) => {
|
||||
};
|
||||
|
||||
const onDownloadAction = () => {
|
||||
setBufferSelection(selectedFolder);
|
||||
downloadAction(t("Translations:ArchivingData"), [currentFolderId]).catch(
|
||||
(err) => toastr.error(err)
|
||||
);
|
||||
downloadAction(t("Translations:ArchivingData"), selectedFolder, [
|
||||
currentFolderId,
|
||||
]).catch((err) => toastr.error(err));
|
||||
};
|
||||
|
||||
const onClickArchiveAction = (e) => {
|
||||
|
@ -437,7 +437,7 @@ class ContextOptionsStore {
|
||||
isFile
|
||||
? window.open(viewUrl, "_self")
|
||||
: this.filesActionsStore
|
||||
.downloadAction(t("Translations:ArchivingData"))
|
||||
.downloadAction(t("Translations:ArchivingData"), item)
|
||||
.catch((err) => toastr.error(err));
|
||||
};
|
||||
|
||||
@ -1128,11 +1128,18 @@ class ContextOptionsStore {
|
||||
t
|
||||
);
|
||||
|
||||
const withOpen = item.id !== this.selectedFolderStore.id;
|
||||
let withOpen = item.id !== this.selectedFolderStore.id;
|
||||
const isPublicRoomType =
|
||||
item.roomType === RoomsType.PublicRoom ||
|
||||
item.roomType === RoomsType.CustomRoom;
|
||||
|
||||
if (item.isRoom && withOpen) {
|
||||
withOpen =
|
||||
this.selectedFolderStore.navigationPath.findIndex(
|
||||
(f) => f.id === item.id
|
||||
) === -1;
|
||||
}
|
||||
|
||||
const optionsModel = [
|
||||
{
|
||||
id: "option_select",
|
||||
|
@ -609,17 +609,15 @@ class FilesActionStore {
|
||||
}
|
||||
};
|
||||
|
||||
downloadAction = (label, folderId) => {
|
||||
downloadAction = (label, item, folderId) => {
|
||||
const { bufferSelection } = this.filesStore;
|
||||
const { isVisible: infoPanelIsVisible, selection: infoPanelSelection } =
|
||||
this.authStore.infoPanelStore;
|
||||
|
||||
const selection = this.filesStore.selection.length
|
||||
const selection = item
|
||||
? [item]
|
||||
: this.filesStore.selection.length
|
||||
? this.filesStore.selection
|
||||
: bufferSelection
|
||||
? [bufferSelection]
|
||||
: infoPanelIsVisible && infoPanelSelection != null
|
||||
? [infoPanelSelection]
|
||||
: null;
|
||||
|
||||
if (!selection.length) return;
|
||||
|
@ -2272,9 +2272,9 @@ class FilesStore {
|
||||
}
|
||||
}
|
||||
|
||||
if (fromInfoPanel) {
|
||||
roomOptions = this.removeOptions(roomOptions, ["external-link"]);
|
||||
}
|
||||
// if (fromInfoPanel) {
|
||||
// roomOptions = this.removeOptions(roomOptions, ["external-link"]);
|
||||
// }
|
||||
|
||||
roomOptions = this.removeSeparator(roomOptions);
|
||||
|
||||
@ -3985,7 +3985,7 @@ class FilesStore {
|
||||
const pathPartsRoomIndex = navigationPath.findIndex((f) => f.id === roomId);
|
||||
if (pathPartsRoomIndex === -1) return;
|
||||
navigationPath[pathPartsRoomIndex].shared = shared;
|
||||
this.selectedFolderStore.setPathParts(navigationPath);
|
||||
this.selectedFolderStore.setNavigationPath(navigationPath);
|
||||
};
|
||||
|
||||
get isFiltered() {
|
||||
|
@ -2,7 +2,7 @@ import { makeAutoObservable } from "mobx";
|
||||
|
||||
import { getUserById } from "../api/people";
|
||||
import { combineUrl, getUserRole } from "../utils";
|
||||
import { FolderType } from "../constants";
|
||||
import { FolderType, ShareAccessRights } from "../constants";
|
||||
import config from "PACKAGE_FILE";
|
||||
import Filter from "../api/people/filter";
|
||||
import { getRoomInfo } from "../api/rooms";
|
||||
@ -169,6 +169,9 @@ class InfoPanelStore {
|
||||
icon: this.getInfoPanelItemIcon(selection, 32),
|
||||
isContextMenuSelection: false,
|
||||
wasContextMenuSelection: !!isContextMenuSelection,
|
||||
canCopyPublicLink:
|
||||
selection.access === ShareAccessRights.RoomManager ||
|
||||
selection.access === ShareAccessRights.None,
|
||||
};
|
||||
};
|
||||
|
||||
@ -195,13 +198,22 @@ class InfoPanelStore {
|
||||
const currentFolderRoomId =
|
||||
this.selectedFolderStore.pathParts &&
|
||||
this.selectedFolderStore.pathParts[1]?.id;
|
||||
const prevRoomId = this.selectionParentRoom?.id;
|
||||
// const prevRoomId = this.selectionParentRoom?.id;
|
||||
|
||||
if (!currentFolderRoomId || currentFolderRoomId === prevRoomId) return;
|
||||
// if (!currentFolderRoomId || currentFolderRoomId === prevRoomId) return;
|
||||
if (!currentFolderRoomId) return;
|
||||
|
||||
const newSelectionParentRoom = await getRoomInfo(currentFolderRoomId);
|
||||
|
||||
if (prevRoomId === newSelectionParentRoom.id) return;
|
||||
// if (prevRoomId === newSelectionParentRoom.id) return;
|
||||
|
||||
const roomIndex = this.selectedFolderStore.navigationPath.findIndex(
|
||||
(f) => f.id === currentFolderRoomId
|
||||
);
|
||||
if (roomIndex > -1) {
|
||||
this.selectedFolderStore.navigationPath[roomIndex].title =
|
||||
newSelectionParentRoom.title;
|
||||
}
|
||||
|
||||
this.setSelectionParentRoom(
|
||||
this.normalizeSelection(newSelectionParentRoom)
|
||||
|
Loading…
Reference in New Issue
Block a user