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.
@@ -24024,6 +24024,7 @@ var useTextbookDetail = function useTextbookDetail(props) {
24024
24024
  return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
24025
24025
  });
24026
24026
  var isAdmin = user === null || user === void 0 ? void 0 : (_user$roles = user.roles) === null || _user$roles === void 0 ? void 0 : _user$roles.includes(Role.Admin);
24027
+ var onAcademy = !!(user !== null && user !== void 0 && user.academyDomain);
24027
24028
  var _useExam = useExam({
24028
24029
  navigate: navigate
24029
24030
  }),
@@ -24722,12 +24723,12 @@ var useTextbookDetail = function useTextbookDetail(props) {
24722
24723
  }, [id, t]);
24723
24724
  var isReadonly = useMemo(function () {
24724
24725
  var _textbook$createdBy;
24725
- if (!user.id) return true;
24726
+ if (!user.id || !onAcademy) return true;
24726
24727
  if (!textbook.id) return false;
24727
24728
  if (isReadonlyParam) return true;
24728
24729
  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;
24729
24730
  return true;
24730
- }, [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]);
24731
+ }, [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]);
24731
24732
  return {
24732
24733
  id: id,
24733
24734
  t: t,
@@ -25615,7 +25616,7 @@ var useTextbookShare = function useTextbookShare(props) {
25615
25616
  setShared(existsTeachers);
25616
25617
  };
25617
25618
  var enabledSave = function enabledSave(textbook) {
25618
- return isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && textbook.isShared && textbook.createdBy.id === infoUser.id;
25619
+ return onAcademy && (isAdminSite || isSuperAdmin || isSuperAdminUser || !isAdmin && textbook.isShared && textbook.createdBy.id === infoUser.id);
25619
25620
  };
25620
25621
  var enabledShare = function enabledShare(textbook) {
25621
25622
  return textbook.isShared && onAcademy && (isAdminSite || isSuperAdminUser || !isAdmin && textbook.createdBy.id === infoUser.id);