touchstudy-core 0.1.119 → 0.1.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +4 -3
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -24013,6 +24013,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
24013
24013
|
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
24014
24014
|
});
|
24015
24015
|
var isAdmin = user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(exports.Role.Admin);
|
24016
|
+
var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
|
24016
24017
|
var _useExam = useExam({
|
24017
24018
|
navigate: navigate
|
24018
24019
|
}),
|
@@ -24711,12 +24712,12 @@ var useTextbookDetail = function useTextbookDetail(props) {
|
|
24711
24712
|
}, [id, t]);
|
24712
24713
|
var isReadonly = React.useMemo(function () {
|
24713
24714
|
var _textbook$createdBy;
|
24714
|
-
if (!user.id) return true;
|
24715
|
+
if (!user.id || !onAcademy) return true;
|
24715
24716
|
if (!textbook.id) return false;
|
24716
24717
|
if (isReadonlyParam) return true;
|
24717
24718
|
if (isAdminSite && isAdmin || !textbook.isCreatedByAdmin && !isAdmin && !isAdminSite && (textbook === null || textbook === void 0 ? void 0 : (_textbook$createdBy = textbook.createdBy) === null || _textbook$createdBy === void 0 ? void 0 : _textbook$createdBy.id) === (user === null || user === void 0 ? void 0 : user.id)) return false;
|
24718
24719
|
return true;
|
24719
|
-
}, [isReadonlyParam, textbook.isCreatedByAdmin, isAdminSite, isAdmin, textbook.id, textbook === null || textbook === void 0 ? void 0 : (_textbook$createdBy2 = textbook.createdBy) === null || _textbook$createdBy2 === void 0 ? void 0 : _textbook$createdBy2.id, user === null || user === void 0 ? void 0 : user.id]);
|
24720
|
+
}, [onAcademy, isReadonlyParam, textbook.isCreatedByAdmin, isAdminSite, isAdmin, textbook.id, textbook === null || textbook === void 0 ? void 0 : (_textbook$createdBy2 = textbook.createdBy) === null || _textbook$createdBy2 === void 0 ? void 0 : _textbook$createdBy2.id, user === null || user === void 0 ? void 0 : user.id]);
|
24720
24721
|
return {
|
24721
24722
|
id: id,
|
24722
24723
|
t: t,
|
@@ -25604,7 +25605,7 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
25604
25605
|
setShared(existsTeachers);
|
25605
25606
|
};
|
25606
25607
|
var enabledSave = function enabledSave(textbook) {
|
25607
|
-
return isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && textbook.isShared && textbook.createdBy.id === infoUser.id;
|
25608
|
+
return onAcademy && (isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && textbook.isShared && textbook.createdBy.id === infoUser.id);
|
25608
25609
|
};
|
25609
25610
|
var enabledShare = function enabledShare(textbook) {
|
25610
25611
|
return textbook.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && textbook.createdBy.id === infoUser.id);
|