Web: Files: Leave-room: fixed translations, fixed bugs
This commit is contained in:
parent
96b249eef4
commit
9c7a3157c3
@ -120,12 +120,12 @@
|
||||
"TableSettingsTitle": "Manage displayed columns",
|
||||
"DocumentEdited": "Cannot perform the action because the document is being edited.",
|
||||
"LeaveTheRoom": "Leave the room",
|
||||
"LeaveRoomDescription": "You are about to leave the room in which you are the owner. You must first transfer the owner's rights to another user.",
|
||||
"ChangeOfRoomOwner": "Change of room Owner",
|
||||
"AssignAnOwner": "Assign an Owner",
|
||||
"LeaveRoomDescription": "You are the owner of this room. Before you leave the room, you must transfer the owner's role to another user.",
|
||||
"ChangeTheRoomOwner": "Change the Room Owner",
|
||||
"AssignOwner": "Assign Owner",
|
||||
"WantLeaveRoom": "Do you really want to leave this room?",
|
||||
"RoomOwner": "Room owner",
|
||||
"YouLeftTheRoom": "You left the room",
|
||||
"YouLeftTheRoomOwner": "You left the room and appointed its new owner.",
|
||||
"YouHaveAppointedNewOwner": "You have appointed a new owner."
|
||||
"YouLeftTheRoom": "You have left the room",
|
||||
"LeftAndAppointNewOwner": "You have left the room and appointed a new owner",
|
||||
"AppointNewOwner": "You have appointed a new owner."
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ const SetRoomParams = ({
|
||||
);
|
||||
};
|
||||
|
||||
const isMe = userId === roomParams.roomOwner.id;
|
||||
const isMe = userId === roomParams?.roomOwner?.id;
|
||||
const canOwnerChange = isAdmin || isMe;
|
||||
|
||||
return (
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import ModalDialog from "@docspace/components/modal-dialog";
|
||||
import Button from "@docspace/components/button";
|
||||
import Text from "@docspace/components/text";
|
||||
@ -6,6 +7,7 @@ import { withTranslation } from "react-i18next";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { ShareAccessRights } from "@docspace/common/constants";
|
||||
import toastr from "@docspace/components/toast/toastr";
|
||||
import RoomsFilter from "@docspace/common/api/rooms/filter";
|
||||
|
||||
const LeaveRoomDialog = (props) => {
|
||||
const {
|
||||
@ -20,8 +22,12 @@ const LeaveRoomDialog = (props) => {
|
||||
userId,
|
||||
removeFiles,
|
||||
isAdmin,
|
||||
setSelected,
|
||||
isRoot,
|
||||
} = props;
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
@ -47,12 +53,21 @@ const LeaveRoomDialog = (props) => {
|
||||
invitations: [{ id: userId, access: ShareAccessRights.None }],
|
||||
})
|
||||
.then(() => {
|
||||
if (!isAdmin) removeFiles(null, [roomId]);
|
||||
if (!isAdmin) {
|
||||
if (isRoot) {
|
||||
const filter = RoomsFilter.getDefault();
|
||||
navigate(`rooms/shared/filter?${filter.toUrlParams()}`);
|
||||
} else {
|
||||
removeFiles(null, [roomId]);
|
||||
}
|
||||
}
|
||||
|
||||
toastr.success(t("Files:YouLeftTheRoom"));
|
||||
})
|
||||
.finally(() => {
|
||||
onClose();
|
||||
setIsLoading(false);
|
||||
setSelected("none");
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -74,7 +89,7 @@ const LeaveRoomDialog = (props) => {
|
||||
<ModalDialog.Footer>
|
||||
<Button
|
||||
key="OkButton"
|
||||
label={isOwner ? t("Files:AssignAnOwner") : t("Common:OKButton")}
|
||||
label={isOwner ? t("Files:AssignOwner") : t("Common:OKButton")}
|
||||
size="normal"
|
||||
primary
|
||||
scale
|
||||
@ -94,28 +109,46 @@ const LeaveRoomDialog = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ auth, dialogsStore, filesStore }) => {
|
||||
const {
|
||||
leaveRoomDialogVisible: visible,
|
||||
setLeaveRoomDialogVisible: setIsVisible,
|
||||
setChangeRoomOwnerIsVisible,
|
||||
} = dialogsStore;
|
||||
const { user } = auth.userStore;
|
||||
const { selection, bufferSelection, updateRoomMemberRole, removeFiles } =
|
||||
filesStore;
|
||||
export default inject(
|
||||
({ auth, dialogsStore, filesStore, selectedFolderStore }) => {
|
||||
const {
|
||||
leaveRoomDialogVisible: visible,
|
||||
setLeaveRoomDialogVisible: setIsVisible,
|
||||
setChangeRoomOwnerIsVisible,
|
||||
} = dialogsStore;
|
||||
const { user } = auth.userStore;
|
||||
const {
|
||||
selection,
|
||||
bufferSelection,
|
||||
updateRoomMemberRole,
|
||||
removeFiles,
|
||||
setSelected,
|
||||
} = filesStore;
|
||||
|
||||
const selections = selection.length ? selection : [bufferSelection];
|
||||
const isRoomOwner = selections[0].createdBy.id === user.id;
|
||||
const roomId = selection.length
|
||||
? selection[0].id
|
||||
: bufferSelection
|
||||
? bufferSelection.id
|
||||
: selectedFolderStore.id;
|
||||
|
||||
return {
|
||||
visible,
|
||||
setIsVisible,
|
||||
setChangeRoomOwnerIsVisible,
|
||||
isOwner: isRoomOwner,
|
||||
updateRoomMemberRole,
|
||||
roomId: selections[0].id,
|
||||
userId: user.id,
|
||||
removeFiles,
|
||||
isAdmin: user.isOwner || user.isAdmin,
|
||||
};
|
||||
})(observer(withTranslation(["Common", "Files"])(LeaveRoomDialog)));
|
||||
const selections = selection.length ? selection : [bufferSelection];
|
||||
const folderItem = selections[0] ? selections[0] : selectedFolderStore;
|
||||
|
||||
const isRoomOwner = folderItem?.createdBy?.id === user.id;
|
||||
const isRoot = selection.length || bufferSelection ? false : true;
|
||||
|
||||
return {
|
||||
visible,
|
||||
setIsVisible,
|
||||
setChangeRoomOwnerIsVisible,
|
||||
isOwner: isRoomOwner,
|
||||
updateRoomMemberRole,
|
||||
roomId,
|
||||
userId: user.id,
|
||||
removeFiles,
|
||||
isAdmin: user.isOwner || user.isAdmin,
|
||||
setSelected,
|
||||
isRoot,
|
||||
};
|
||||
}
|
||||
)(observer(withTranslation(["Common", "Files"])(LeaveRoomDialog)));
|
||||
|
@ -72,7 +72,7 @@ const ChangeRoomOwner = (props) => {
|
||||
})
|
||||
.then(() => {
|
||||
if (!isAdmin) removeFiles(null, [roomId]);
|
||||
toastr.success(t("Files:YouLeftTheRoomOwner"));
|
||||
toastr.success(t("Files:LeftAndAppointNewOwner"));
|
||||
})
|
||||
.finally(() => {
|
||||
onClose();
|
||||
@ -92,7 +92,7 @@ const ChangeRoomOwner = (props) => {
|
||||
.then(async (res) => {
|
||||
setFolder(res[0]);
|
||||
if (isChecked) await onLeaveRoom();
|
||||
else toastr.success(t("Files:YouHaveAppointedNewOwner"));
|
||||
else toastr.success(t("Files:AppointNewOwner"));
|
||||
setRoomParams && setRoomParams(res[0].createdBy);
|
||||
})
|
||||
.finally(() => {
|
||||
@ -133,8 +133,8 @@ const ChangeRoomOwner = (props) => {
|
||||
{...backClickProp}
|
||||
onAccept={onChangeRoomOwner}
|
||||
onCancel={onClose}
|
||||
acceptButtonLabel={t("Files:AssignAnOwner")}
|
||||
headerLabel={t("Files:ChangeOfRoomOwner")}
|
||||
acceptButtonLabel={t("Files:AssignOwner")}
|
||||
headerLabel={t("Files:ChangeTheRoomOwner")}
|
||||
filter={filter}
|
||||
isLoading={isLoading}
|
||||
withFooterCheckbox={!showBackButton}
|
||||
|
@ -1116,7 +1116,7 @@ class ContextOptionsStore {
|
||||
label: t("LeaveTheRoom"),
|
||||
icon: LeaveRoomSvgUrl,
|
||||
onClick: this.onLeaveRoom,
|
||||
disabled: false,
|
||||
disabled: this.treeFoldersStore.isArchiveFolder,
|
||||
},
|
||||
{
|
||||
id: "option_unarchive-room",
|
||||
|
Loading…
Reference in New Issue
Block a user