mirror of
https://github.com/makeplane/plane.git
synced 2025-12-29 00:24:56 +01:00
Merge pull request #309 from makeplane/sync/ce-ee
sync: community changes
This commit is contained in:
@@ -17,6 +17,7 @@ AUTHENTICATION_ERROR_CODES = {
|
||||
"INVALID_EMAIL_SIGN_UP": 5045,
|
||||
"INVALID_EMAIL_MAGIC_SIGN_UP": 5050,
|
||||
"MAGIC_SIGN_UP_EMAIL_CODE_REQUIRED": 5055,
|
||||
"EMAIL_PASSWORD_AUTHENTICATION_DISABLED": 5056,
|
||||
# Sign In
|
||||
"USER_DOES_NOT_EXIST": 5060,
|
||||
"AUTHENTICATION_FAILED_SIGN_IN": 5065,
|
||||
|
||||
@@ -41,8 +41,10 @@ class EmailProvider(CredentialAdapter):
|
||||
|
||||
if ENABLE_EMAIL_PASSWORD == "0":
|
||||
raise AuthenticationException(
|
||||
error_code=AUTHENTICATION_ERROR_CODES["ENABLE_EMAIL_PASSWORD"],
|
||||
error_message="ENABLE_EMAIL_PASSWORD",
|
||||
error_code=AUTHENTICATION_ERROR_CODES[
|
||||
"EMAIL_PASSWORD_AUTHENTICATION_DISABLED"
|
||||
],
|
||||
error_message="EMAIL_PASSWORD_AUTHENTICATION_DISABLED",
|
||||
)
|
||||
|
||||
def set_user_data(self):
|
||||
|
||||
@@ -68,7 +68,7 @@ export const IssueBlock = observer((props: IssueBlockProps) => {
|
||||
setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id, nestingLevel: nestingLevel });
|
||||
|
||||
const issue = issuesMap[issueId];
|
||||
const subIssuesCount = issue.sub_issues_count;
|
||||
const subIssuesCount = issue?.sub_issues_count ?? 0;
|
||||
|
||||
const { isMobile } = usePlatformOS();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
|
||||
const currentLayout = `${activeLayout} layout`;
|
||||
// derived values
|
||||
const stateDetails = getStateById(issue.state_id);
|
||||
const subIssueCount = issue.sub_issues_count;
|
||||
const subIssueCount = issue?.sub_issues_count ?? 0;
|
||||
|
||||
const issueOperations = useMemo(
|
||||
() => ({
|
||||
|
||||
@@ -19,7 +19,7 @@ export const SpreadsheetSubIssueColumn: React.FC<Props> = observer((props: Props
|
||||
// hooks
|
||||
const { workspaceSlug } = useAppRouter();
|
||||
// derived values
|
||||
const subIssueCount = issue.sub_issues_count;
|
||||
const subIssueCount = issue?.sub_issues_count ?? 0;
|
||||
|
||||
const redirectToIssueDetail = () => {
|
||||
router.push({
|
||||
|
||||
@@ -203,7 +203,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
|
||||
};
|
||||
|
||||
const disableUserActions = !canEditProperties(issueDetail.project_id);
|
||||
const subIssuesCount = issueDetail.sub_issues_count;
|
||||
const subIssuesCount = issueDetail?.sub_issues_count ?? 0;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -61,7 +61,7 @@ export const IssueListItem: React.FC<ISubIssues> = observer((props) => {
|
||||
undefined;
|
||||
|
||||
const subIssueHelpers = subIssueHelpersByIssueId(parentIssueId);
|
||||
const subIssueCount = issue?.sub_issues_count || 0;
|
||||
const subIssueCount = issue?.sub_issues_count ?? 0;
|
||||
|
||||
const handleIssuePeekOverview = (issue: TIssue) =>
|
||||
workspaceSlug &&
|
||||
|
||||
@@ -59,9 +59,8 @@ const calculateShades = (hexValue: string): TShades => {
|
||||
return shades as TShades;
|
||||
};
|
||||
|
||||
export const applyTheme = (palette: string, isDarkPalette: boolean) => {
|
||||
export const applyTheme = (palette: string, isDarkPalette: boolean, dom: HTMLElement | null) => {
|
||||
if (!palette) return;
|
||||
const dom = document?.querySelector<HTMLElement>("[data-theme='custom']");
|
||||
// palette: [bg, text, primary, sidebarBg, sidebarText]
|
||||
const values: string[] = palette.split(",");
|
||||
values.push(isDarkPalette ? "dark" : "light");
|
||||
|
||||
@@ -22,7 +22,7 @@ const StoreWrapper: FC<TStoreWrapper> = observer((props) => {
|
||||
const { sidebarCollapsed, toggleSidebar } = useAppTheme();
|
||||
const { data: userProfile } = useUserProfile();
|
||||
// states
|
||||
const [dom, setDom] = useState<undefined | HTMLElement>();
|
||||
const [dom, setDom] = useState<HTMLElement | null>(null);
|
||||
|
||||
/**
|
||||
* Sidebar collapsed fetching from local storage
|
||||
@@ -38,19 +38,40 @@ const StoreWrapper: FC<TStoreWrapper> = observer((props) => {
|
||||
* Setting up the theme of the user by fetching it from local storage
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (!userProfile?.theme?.theme) return;
|
||||
if (window) setDom(() => window.document?.querySelector<HTMLElement>("[data-theme='custom']") || undefined);
|
||||
|
||||
setTheme(userProfile?.theme?.theme || "system");
|
||||
if (userProfile?.theme?.theme === "custom" && userProfile?.theme?.palette && dom)
|
||||
if (!userProfile?.theme?.theme) return;
|
||||
|
||||
if (userProfile?.theme?.theme === "custom" && userProfile?.theme?.palette) {
|
||||
applyTheme(
|
||||
userProfile?.theme?.palette !== ",,,,"
|
||||
? userProfile?.theme?.palette
|
||||
: "#0d101b,#c5c5c5,#3f76ff,#0d101b,#c5c5c5",
|
||||
false
|
||||
false,
|
||||
dom
|
||||
);
|
||||
else unsetCustomCssVariables();
|
||||
}, [userProfile, userProfile?.theme?.theme, userProfile?.theme?.palette, setTheme, dom]);
|
||||
} else unsetCustomCssVariables();
|
||||
}, [userProfile, userProfile?.theme, userProfile?.theme?.palette, setTheme, dom]);
|
||||
|
||||
useEffect(() => {
|
||||
if (dom) return;
|
||||
|
||||
const observer = new MutationObserver((mutationsList, observer) => {
|
||||
for (const mutation of mutationsList) {
|
||||
if (mutation.type === "childList") {
|
||||
const customThemeElement = window.document?.querySelector<HTMLElement>("[data-theme='custom']");
|
||||
if (customThemeElement) {
|
||||
setDom(customThemeElement);
|
||||
observer.disconnect();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, [dom]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!router.query) return;
|
||||
|
||||
@@ -69,6 +69,10 @@ const nextConfig = {
|
||||
const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || ""
|
||||
const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || ""
|
||||
const GOD_MODE_BASE_URL = ADMIN_BASE_URL + ADMIN_BASE_PATH
|
||||
rewrites.push({
|
||||
source: "/god-mode",
|
||||
destination: `${GOD_MODE_BASE_URL}/`,
|
||||
})
|
||||
rewrites.push({
|
||||
source: "/god-mode/:path*",
|
||||
destination: `${GOD_MODE_BASE_URL}/:path*`,
|
||||
|
||||
Reference in New Issue
Block a user