Merge branch 'bugfix/list-accounts-double-fetch' of github.com:ONLYOFFICE/DocSpace-client into bugfix/list-accounts-double-fetch

This commit is contained in:
Akmal Isomadinov 2023-11-24 18:37:21 +05:00
commit 3c4738bc14
7 changed files with 75 additions and 18 deletions

View File

@ -21,6 +21,7 @@ const ChangeUserTypeEvent = ({
getPeopleListItem, getPeopleListItem,
setSelection, setSelection,
needResetUserSelection, needResetUserSelection,
isRoomAdmin,
}) => { }) => {
const { toType, fromType, userIDs, successCallback, abortCallback } = const { toType, fromType, userIDs, successCallback, abortCallback } =
peopleDialogData; peopleDialogData;
@ -78,9 +79,11 @@ const ChangeUserTypeEvent = ({
toastr.error( toastr.error(
<> <>
<Text>{t("Common:QuotaPaidUserLimitError")}</Text> <Text>{t("Common:QuotaPaidUserLimitError")}</Text>
<Link color="#5387AD" isHovered={true} onClick={onClickPayments}> {!isRoomAdmin && (
{t("Common:PaymentsTitle")} <Link color="#5387AD" isHovered={true} onClick={onClickPayments}>
</Link> {t("Common:PaymentsTitle")}
</Link>
)}
</>, </>,
false, false,
0, 0,
@ -140,7 +143,8 @@ export default inject(({ auth, dialogsStore, peopleStore }) => {
changeUserTypeDialogVisible: visible, changeUserTypeDialogVisible: visible,
setChangeUserTypeDialogVisible: setVisible, setChangeUserTypeDialogVisible: setVisible,
} = dialogsStore; } = dialogsStore;
const { setSelection } = auth.infoPanelStore; const { isRoomAdmin, infoPanelStore } = auth;
const { setSelection } = infoPanelStore;
const { dialogStore, filterStore, usersStore } = peopleStore; const { dialogStore, filterStore, usersStore } = peopleStore;
const { data: peopleDialogData } = dialogStore; const { data: peopleDialogData } = dialogStore;
@ -153,6 +157,7 @@ export default inject(({ auth, dialogsStore, peopleStore }) => {
} = usersStore; } = usersStore;
const { setSelected } = peopleStore.selectionStore; const { setSelected } = peopleStore.selectionStore;
return { return {
isRoomAdmin,
needResetUserSelection, needResetUserSelection,
getPeopleListItem, getPeopleListItem,
setSelection, setSelection,

View File

@ -4,6 +4,8 @@ import PropTypes from "prop-types";
import ModalDialog from "@docspace/components/modal-dialog"; import ModalDialog from "@docspace/components/modal-dialog";
import Button from "@docspace/components/button"; import Button from "@docspace/components/button";
import Text from "@docspace/components/text"; import Text from "@docspace/components/text";
import Link from "@docspace/components/link";
import { combineUrl } from "@docspace/common/utils";
import { withTranslation } from "react-i18next"; import { withTranslation } from "react-i18next";
import toastr from "@docspace/components/toast/toastr"; import toastr from "@docspace/components/toast/toastr";
@ -18,6 +20,15 @@ class ChangeUserStatusDialogComponent extends React.Component {
this.state = { isRequestRunning: false }; this.state = { isRequestRunning: false };
} }
onClickPayments = () => {
const paymentPageUrl = combineUrl(
"/portal-settings",
"/payments/portal-payments"
);
toastr.clear();
window.DocSpace.navigate(paymentPageUrl);
};
onChangeUserStatus = () => { onChangeUserStatus = () => {
const { const {
updateUserStatus, updateUserStatus,
@ -43,7 +54,24 @@ class ChangeUserStatusDialogComponent extends React.Component {
toastr.success(t("PeopleTranslations:SuccessChangeUserStatus")); toastr.success(t("PeopleTranslations:SuccessChangeUserStatus"));
}) })
.catch((error) => toastr.error(error)) .catch((err) => {
toastr.error(
<>
<Text>{t("Common:QuotaPaidUserLimitError")}</Text>
<Link
color="#5387AD"
isHovered={true}
onClick={this.onClickPayments}
>
{t("Common:PaymentsTitle")}
</Link>
</>,
false,
0,
true,
true
);
})
.finally(() => { .finally(() => {
this.setState({ isRequestRunning: false }, () => { this.setState({ isRequestRunning: false }, () => {
needResetUserSelection && setSelected("close"); needResetUserSelection && setSelected("close");

View File

@ -48,6 +48,8 @@ const DataReassignmentDialog = ({
setIsDeletingUserWithReassignment, setIsDeletingUserWithReassignment,
setDataReassignmentDeleteProfile, setDataReassignmentDeleteProfile,
dataReassignmentUrl, dataReassignmentUrl,
needResetUserSelection,
setSelected
}) => { }) => {
const [selectorVisible, setSelectorVisible] = useState(false); const [selectorVisible, setSelectorVisible] = useState(false);
const defaultSelectedUser = isDeletingUserWithReassignment const defaultSelectedUser = isDeletingUserWithReassignment
@ -146,6 +148,9 @@ const DataReassignmentDialog = ({
.then(() => checkProgress()) .then(() => checkProgress())
.catch((error) => { .catch((error) => {
toastr.error(error?.response?.data?.error?.message); toastr.error(error?.response?.data?.error?.message);
})
.finally(() => {
needResetUserSelection && setSelected("close");
}); });
}; };
@ -250,6 +255,7 @@ export default inject(({ auth, peopleStore, setup }) => {
setIsDeletingUserWithReassignment, setIsDeletingUserWithReassignment,
} = peopleStore.dialogStore; } = peopleStore.dialogStore;
const { currentColorScheme, dataReassignmentUrl } = auth.settingsStore; const { currentColorScheme, dataReassignmentUrl } = auth.settingsStore;
const {setSelected} = peopleStore.selectionStore;
const { const {
dataReassignment, dataReassignment,
dataReassignmentProgress, dataReassignmentProgress,
@ -258,7 +264,7 @@ export default inject(({ auth, peopleStore, setup }) => {
const { user: currentUser } = peopleStore.authStore.userStore; const { user: currentUser } = peopleStore.authStore.userStore;
const { getUsersList } = peopleStore.usersStore; const { getUsersList, needResetUserSelection } = peopleStore.usersStore;
return { return {
setDataReassignmentDialogVisible, setDataReassignmentDialogVisible,
@ -274,6 +280,8 @@ export default inject(({ auth, peopleStore, setup }) => {
isDeletingUserWithReassignment, isDeletingUserWithReassignment,
setIsDeletingUserWithReassignment, setIsDeletingUserWithReassignment,
dataReassignmentUrl, dataReassignmentUrl,
needResetUserSelection,
setSelected
}; };
})( })(
observer( observer(

View File

@ -267,9 +267,10 @@ const InvitePanel = ({
try { try {
setIsLoading(true); setIsLoading(true);
roomId === -1 const result =
? await inviteUsers(data) roomId === -1
: await setRoomSecurity(roomId, data); ? await inviteUsers(data)
: await setRoomSecurity(roomId, data);
setIsLoading(false); setIsLoading(false);
@ -279,6 +280,11 @@ const InvitePanel = ({
onClose(); onClose();
toastr.success(t("Common:UsersInvited")); toastr.success(t("Common:UsersInvited"));
if (result?.warning) {
toastr.warning(result?.warning);
}
reloadSelectionParentRoom(); reloadSelectionParentRoom();
} catch (err) { } catch (err) {
toastr.error(err); toastr.error(err);

View File

@ -254,6 +254,7 @@ const SectionFilterContent = ({
setRoomsFilter, setRoomsFilter,
standalone, standalone,
currentDeviceType, currentDeviceType,
isRoomAdmin,
}) => { }) => {
const location = useLocation(); const location = useLocation();
const navigate = useNavigate(); const navigate = useNavigate();
@ -1001,13 +1002,15 @@ const SectionFilterContent = ({
group: "filter-status", group: "filter-status",
label: t("PeopleTranslations:PendingTitle"), label: t("PeopleTranslations:PendingTitle"),
}, },
{ ];
if (!isRoomAdmin)
statusItems.push({
id: "filter_status-disabled", id: "filter_status-disabled",
key: 3, key: 3,
group: "filter-status", group: "filter-status",
label: t("PeopleTranslations:DisabledEmployeeStatus"), label: t("PeopleTranslations:DisabledEmployeeStatus"),
}, });
];
const typeItems = [ const typeItems = [
{ {
@ -2088,7 +2091,7 @@ export default inject(
const { providers } = thirdPartyStore; const { providers } = thirdPartyStore;
const { fetchTags } = tagsStore; const { fetchTags } = tagsStore;
const { isRoomAdmin } = auth;
const { user } = auth.userStore; const { user } = auth.userStore;
const { personal, standalone, currentDeviceType } = auth.settingsStore; const { personal, standalone, currentDeviceType } = auth.settingsStore;
const { const {
@ -2119,6 +2122,7 @@ export default inject(
const { canSearchByContent } = filesSettingsStore; const { canSearchByContent } = filesSettingsStore;
return { return {
isRoomAdmin,
user, user,
userId: user?.id, userId: user?.id,

View File

@ -12,7 +12,7 @@ const LocalFile = ({ setRestoreResource, isEnableRestore, t }) => {
scale scale
className="restore-backup_input" className="restore-backup_input"
isDisabled={!isEnableRestore} isDisabled={!isEnableRestore}
accept={[".tar", ".tar.gz"]} accept={[".tar", ".gz"]}
/> />
); );
}; };

View File

@ -36,6 +36,7 @@
temp = agent.match( temp = agent.match(
/\b(OPR|Edge|AscDesktopEditor|SamsungBrowser|UCBrowser)\/(\d+.\d)/ /\b(OPR|Edge|AscDesktopEditor|SamsungBrowser|UCBrowser)\/(\d+.\d)/
); );
const userOS = const userOS =
agent.search("Linux") !== -1 && agent.search("X11") !== -1 agent.search("Linux") !== -1 && agent.search("X11") !== -1
? "Linux" ? "Linux"
@ -45,7 +46,7 @@
return { return {
name: temp[1].replace("OPR", "Opera"), name: temp[1].replace("OPR", "Opera"),
version: temp[2], version: temp[2],
chromeVersion: match[2], chromeVersion: match[2] || 70,
userOS, userOS,
}; };
} }
@ -64,12 +65,16 @@
} }
if ((temp = agent.match(/mobile/i)) != null) { if ((temp = agent.match(/mobile/i)) != null) {
if ((temp = agent.match(/chrome\/?\s*(\d+)/i))) { if ((temp = agent.match(/chrome\/?\s*(\d+)/i)) != null) {
match[1] = temp[1]; match[1] = temp[1];
} }
} }
return { name: match[0], version: match[1] }; return {
name: match[0],
version: match[1],
chromeVersion: match[1] || 70,
};
})(); })();
} }
@ -83,7 +88,8 @@
return false; return false;
if ( if (
+this.browser.version < this.unsupportedBrowsers[this.browser.name] +this.browser.version < this.unsupportedBrowsers[this.browser.name] &&
+this.browser.chromeVersion < this.unsupportedBrowsers.Chrome
) { ) {
return false; return false;
} }