Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/admin/app/(all)/(dashboard)/general/intercom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export const IntercomConfig = observer(function IntercomConfig(props: TIntercomC
const isIntercomEnabled = isTelemetryEnabled
? instanceConfigurations
? instanceConfigurations?.find((config) => config.key === "IS_INTERCOM_ENABLED")?.value === "1"
? true
: false
: undefined
: false;

Expand Down Expand Up @@ -73,7 +71,7 @@ export const IntercomConfig = observer(function IntercomConfig(props: TIntercomC

<div className="ml-auto">
<ToggleSwitch
value={isIntercomEnabled ? true : false}
value={!!isIntercomEnabled}
onChange={enableIntercomConfig}
size="sm"
disabled={!isTelemetryEnabled || isSubmitting || initialLoader}
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/app/(all)/(home)/sign-in-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function InstanceSignInForm() {
}, [errorCode, errorMessage]);

const isButtonDisabled = useMemo(
() => (!isSubmitting && formData.email && formData.password ? false : true),
() => !(!isSubmitting && formData.email && formData.password),
[formData.email, formData.password, isSubmitting]
);

Expand Down
22 changes: 11 additions & 11 deletions apps/admin/components/instance/setup-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function InstanceSetupForm() {
const lastNameParam = searchParams?.get("last_name") || undefined;
const companyParam = searchParams?.get("company") || undefined;
const emailParam = searchParams?.get("email") || undefined;
const isTelemetryEnabledParam = (searchParams?.get("is_telemetry_enabled") === "True" ? true : false) || true;
const isTelemetryEnabledParam = searchParams?.get("is_telemetry_enabled") === "True" || true;
const errorCode = searchParams?.get("error_code") || undefined;
Comment on lines +67 to 68
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore three-state parsing for is_telemetry_enabled.

searchParams?.get("is_telemetry_enabled") === "True" || true is always true, so this setup flow can no longer honor is_telemetry_enabled=False from the query string. Because Lines 97-98 then copy that value into formData, the hidden field at Line 161 will always submit "True". That is a real behavior change in a telemetry opt-out path, and it diverges from apps/admin/app/(all)/(dashboard)/general/form.tsx:45-68, where telemetry is treated as a real boolean.

Proposed fix
-  const isTelemetryEnabledParam = searchParams?.get("is_telemetry_enabled") === "True" || true;
+  const isTelemetryEnabledParam = searchParams?.get("is_telemetry_enabled");
@@
-    if (isTelemetryEnabledParam) setFormData((prev) => ({ ...prev, is_telemetry_enabled: isTelemetryEnabledParam }));
+    if (isTelemetryEnabledParam !== null) {
+      setFormData((prev) => ({
+        ...prev,
+        is_telemetry_enabled: isTelemetryEnabledParam === "True",
+      }));
+    }

Also applies to: 92-98

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/admin/components/instance/setup-form.tsx` around lines 67 - 68, The
value for isTelemetryEnabledParam is forced true by the `... === "True" || true`
expression, so restore three-state parsing by reading
`searchParams.get("is_telemetry_enabled")` and mapping `"True" -> true`,
`"False" -> false`, and anything else -> undefined (or null) before copying into
`formData`; update the variable `isTelemetryEnabledParam` in setup-form.tsx and
any subsequent code that copies it into `formData` (and the analogous block
around the later copy) so the hidden telemetry field will submit the actual
parsed boolean or no value when unset.

const errorMessage = searchParams?.get("error_message") || undefined;
// state
Expand Down Expand Up @@ -121,14 +121,14 @@ export function InstanceSetupForm() {

const isButtonDisabled = useMemo(
() =>
!isSubmitting &&
formData.first_name &&
formData.email &&
formData.password &&
getPasswordStrength(formData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
formData.password === formData.confirm_password
? false
: true,
!(
!isSubmitting &&
formData.first_name &&
formData.email &&
formData.password &&
getPasswordStrength(formData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
formData.password === formData.confirm_password
),
[formData.confirm_password, formData.email, formData.first_name, formData.password, isSubmitting]
);

Expand Down Expand Up @@ -221,7 +221,7 @@ export function InstanceSetupForm() {
placeholder="name@company.com"
value={formData.email}
onChange={(e) => handleFormChange("email", e.target.value)}
hasError={errorData.type && errorData.type === EErrorCodes.INVALID_EMAIL ? true : false}
hasError={errorData.type && errorData.type === EErrorCodes.INVALID_EMAIL}
autoComplete="off"
/>
{errorData.type && errorData.type === EErrorCodes.INVALID_EMAIL && errorData.message && (
Expand Down Expand Up @@ -265,7 +265,7 @@ export function InstanceSetupForm() {
placeholder="New password"
value={formData.password}
onChange={(e) => handleFormChange("password", e.target.value)}
hasError={errorData.type && errorData.type === EErrorCodes.INVALID_PASSWORD ? true : false}
hasError={errorData.type && errorData.type === EErrorCodes.INVALID_PASSWORD}
onFocus={() => setIsPasswordInputFocused(true)}
onBlur={() => setIsPasswordInputFocused(false)}
autoComplete="new-password"
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/providers/user.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const UserProvider = observer(function UserProvider({ children }: React.P

useEffect(() => {
const localValue = localStorage && localStorage.getItem("god_mode_sidebar_collapsed");
const localBoolValue = localValue ? (localValue === "true" ? true : false) : false;
const localBoolValue = localValue ? localValue === "true" : false;
if (isSidebarCollapsed === undefined && localBoolValue != isSidebarCollapsed) toggleSidebar(localBoolValue);
}, [isSidebarCollapsed, currentUser, toggleSidebar]);

Expand Down
2 changes: 1 addition & 1 deletion apps/space/components/account/auth-forms/auth-root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const AuthRoot = observer(function AuthRoot() {
}}
/>
)}
<TermsAndConditions isSignUp={authMode === EAuthModes.SIGN_UP ? true : false} />
<TermsAndConditions isSignUp={authMode === EAuthModes.SIGN_UP} />
</div>
</div>
);
Expand Down
16 changes: 8 additions & 8 deletions apps/space/components/account/auth-forms/password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)

const isButtonDisabled = useMemo(
() =>
!isSubmitting &&
!!passwordFormData.password &&
(mode === EAuthModes.SIGN_UP
? getPasswordStrength(passwordFormData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
passwordFormData.password === passwordFormData.confirm_password
: true)
? false
: true,
!(
!isSubmitting &&
!!passwordFormData.password &&
(mode === EAuthModes.SIGN_UP
? getPasswordStrength(passwordFormData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
passwordFormData.password === passwordFormData.confirm_password
: true)
),
[isSubmitting, mode, passwordFormData.confirm_password, passwordFormData.password]
);

Expand Down
2 changes: 1 addition & 1 deletion apps/space/components/issues/filters/labels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function FilterLabels(props: Props) {
{filteredOptions.slice(0, itemsToRender).map((label) => (
<FilterOption
key={label?.id}
isChecked={appliedFilters?.includes(label?.id) ? true : false}
isChecked={appliedFilters?.includes(label?.id)}
onClick={() => handleUpdate(label?.id)}
icon={<LabelIcons color={label.color} />}
title={label.name}
Expand Down
2 changes: 1 addition & 1 deletion apps/space/components/issues/filters/priority.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const FilterPriority = observer(function FilterPriority(props: Props) {
filteredOptions.map((priority) => (
<FilterOption
key={priority.key}
isChecked={appliedFilters?.includes(priority.key) ? true : false}
isChecked={appliedFilters?.includes(priority.key)}
onClick={() => handleUpdate(priority.key)}
icon={<PriorityIcon priority={priority.key} className="h-3.5 w-3.5" />}
title={t(priority.titleTranslationKey)}
Expand Down
2 changes: 1 addition & 1 deletion apps/space/components/issues/filters/state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const FilterState = observer(function FilterState(props: Props) {
{filteredOptions.slice(0, itemsToRender).map((state) => (
<FilterOption
key={state.id}
isChecked={appliedFilters?.includes(state.id) ? true : false}
isChecked={appliedFilters?.includes(state.id)}
onClick={() => handleUpdate(state.id)}
icon={<StateGroupIcon stateGroup={state.group} color={state.color} size={EIconSize.MD} />}
title={state.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ export const ExtendedAppSidebar = observer(function ExtendedAppSidebar() {
})
.map((item) => {
const preference = currentWorkspaceNavigationPreferences?.[item.key];
return {
...item,
return Object.assign({}, item, {
sort_order: preference?.sort_order ?? 0,
is_pinned: preference?.is_pinned ?? false,
};
});
})
.sort((a, b) => {
// First sort by pinned status (pinned items first)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function CycleDetailPage({ params }: Route.ComponentProps) {
cycleId,
});
// derived values
const isSidebarCollapsed = storedValue ? (storedValue === true ? true : false) : false;
const isSidebarCollapsed = storedValue ? storedValue === true : false;
const cycle = getCycleById(cycleId);
const project = getProjectById(projectId);
const pageTitle = project?.name && cycle?.name ? `${project?.name} - ${cycle?.name}` : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const CycleIssuesHeader = observer(function CycleIssuesHeader() {

const { setValue, storedValue } = useLocalStorage("cycle_sidebar_collapsed", false);

const isSidebarCollapsed = storedValue ? (storedValue === true ? true : false) : false;
const isSidebarCollapsed = storedValue ? storedValue === true : false;
const toggleSidebar = () => {
setValue(!isSidebarCollapsed);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function ModuleIssuesPage({ params }: Route.ComponentProps) {
// const { issuesFilter } = useIssues(EIssuesStoreType.MODULE);
// local storage
const { setValue, storedValue } = useLocalStorage("module_sidebar_collapsed", "false");
const isSidebarCollapsed = storedValue ? (storedValue === "true" ? true : false) : false;
const isSidebarCollapsed = storedValue ? storedValue === "true" : false;
// fetching module details
const { error } = useSWR(`CURRENT_MODULE_DETAILS_${moduleId}`, () =>
fetchModuleDetails(workspaceSlug, projectId, moduleId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const ModuleIssuesHeader = observer(function ModuleIssuesHeader() {
// local storage
const { setValue, storedValue } = useLocalStorage("module_sidebar_collapsed", "false");
// derived values
const isSidebarCollapsed = storedValue ? (storedValue === "true" ? true : false) : false;
const isSidebarCollapsed = storedValue ? storedValue === "true" : false;
const activeLayout = issueFilters?.displayFilters?.layout;
const moduleDetails = moduleId ? getModuleById(moduleId) : undefined;
const canUserCreateIssue = allowPermissions(
Expand Down
10 changes: 5 additions & 5 deletions apps/web/core/components/account/auth-forms/password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)

const isButtonDisabled = useMemo(
() =>
!isSubmitting &&
!!passwordFormData.password &&
(mode === EAuthModes.SIGN_UP ? passwordFormData.password === passwordFormData.confirm_password : true)
? false
: true,
!(
!isSubmitting &&
!!passwordFormData.password &&
(mode === EAuthModes.SIGN_UP ? passwordFormData.password === passwordFormData.confirm_password : true)
),
[isSubmitting, mode, passwordFormData.confirm_password, passwordFormData.password]
);

Expand Down
10 changes: 5 additions & 5 deletions apps/web/core/components/account/auth-forms/reset-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ export const ResetPasswordForm = observer(function ResetPasswordForm() {

const isButtonDisabled = useMemo(
() =>
!!resetFormData.password &&
getPasswordStrength(resetFormData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
resetFormData.password === resetFormData.confirm_password
? false
: true,
!(
!!resetFormData.password &&
getPasswordStrength(resetFormData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
resetFormData.password === resetFormData.confirm_password
),
[resetFormData]
);

Expand Down
10 changes: 5 additions & 5 deletions apps/web/core/components/account/auth-forms/set-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ export const SetPasswordForm = observer(function SetPasswordForm() {

const isButtonDisabled = useMemo(
() =>
!!passwordFormData.password &&
getPasswordStrength(passwordFormData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
passwordFormData.password === passwordFormData.confirm_password
? false
: true,
!(
!!passwordFormData.password &&
getPasswordStrength(passwordFormData.password) === E_PASSWORD_STRENGTH.STRENGTH_VALID &&
passwordFormData.password === passwordFormData.confirm_password
),
[passwordFormData]
);

Expand Down
5 changes: 1 addition & 4 deletions apps/web/core/components/chart/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ export const parseChartData = (
}
}

return {
...datum,
...missingValues,
};
return Object.assign({}, datum, missingValues);
});

// capitalize first letter if groupByProperty is in TO_CAPITALIZE_PROPERTIES
Expand Down
4 changes: 2 additions & 2 deletions apps/web/core/components/common/filters/created-at.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const FilterCreatedDate = observer(function FilterCreatedDate(props: Prop

const isCustomDateSelected = () => {
const isValidDateSelected = appliedFilters?.filter((f) => isInDateFormat(f.split(";")[0])) || [];
return isValidDateSelected.length > 0 ? true : false;
return isValidDateSelected.length > 0;
};
const handleCustomDate = () => {
if (isCustomDateSelected()) {
Expand Down Expand Up @@ -64,7 +64,7 @@ export const FilterCreatedDate = observer(function FilterCreatedDate(props: Prop
{filteredOptions.map((option) => (
<FilterOption
key={option.value}
isChecked={appliedFilters?.includes(option.value) ? true : false}
isChecked={appliedFilters?.includes(option.value)}
onClick={() => handleUpdate(option.value)}
title={option.name}
multiple
Expand Down
2 changes: 1 addition & 1 deletion apps/web/core/components/common/filters/created-by.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const FilterCreatedBy = observer(function FilterCreatedBy(props: Props) {
return (
<FilterOption
key={`member-${member.id}`}
isChecked={appliedFilters?.includes(member.id) ? true : false}
isChecked={appliedFilters?.includes(member.id)}
onClick={() => handleUpdate(member.id)}
icon={
<Avatar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ export const CycleSidebarDetails = observer(function CycleSidebarDetails(props:
const cycleOwnerDetails = cycleDetails ? getUserDetails(cycleDetails.owned_by_id) : undefined;

const isEstimatePointValid = isEmpty(cycleDetails?.progress_snapshot || {})
? estimateType && estimateType?.type == EEstimateSystem.POINTS
? true
: false
: isEmpty(cycleDetails?.progress_snapshot?.estimate_distribution || {})
? false
: true;
? !!(estimateType && estimateType?.type == EEstimateSystem.POINTS)
: !isEmpty(cycleDetails?.progress_snapshot?.estimate_distribution || {});

const issueEstimatePointCount =
isCompleted && !isEmpty(cycleDetails?.progress_snapshot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ArchivedCyclesHeader = observer(function ArchivedCyclesHeader() {
const { currentProjectArchivedFilters, archivedCyclesSearchQuery, updateFilters, updateArchivedCyclesSearchQuery } =
useCycleFilter();
// states
const [isSearchOpen, setIsSearchOpen] = useState(archivedCyclesSearchQuery !== "" ? true : false);
const [isSearchOpen, setIsSearchOpen] = useState(archivedCyclesSearchQuery !== "");
// outside click detector hook
useOutsideClickDetector(inputRef, () => {
if (isSearchOpen && archivedCyclesSearchQuery.trim() === "") setIsSearchOpen(false);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/core/components/cycles/cycles-view-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const CyclesViewHeader = observer(function CyclesViewHeader(props: Props)
const { currentProjectFilters, searchQuery, updateFilters, updateSearchQuery } = useCycleFilter();
const { t } = useTranslation();
// states
const [isSearchOpen, setIsSearchOpen] = useState(searchQuery !== "" ? true : false);
const [isSearchOpen, setIsSearchOpen] = useState(searchQuery !== "");
// outside click detector hook
useOutsideClickDetector(inputRef, () => {
if (isSearchOpen && searchQuery.trim() === "") setIsSearchOpen(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const EstimateTypeDropdown = observer(function EstimateTypeDropdown(props
const { value, onChange, projectId, cycleId, showDefault = false } = props;
const { getIsPointsDataAvailable } = useCycle();
const { areEstimateEnabledByProjectId, currentProjectEstimateType } = useProjectEstimates();
const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId) ? true : false;
const isCurrentProjectEstimateEnabled = !!(projectId && areEstimateEnabledByProjectId(projectId));
return (getIsPointsDataAvailable(cycleId) || isCurrentProjectEstimateEnabled) &&
currentProjectEstimateType !== EEstimateSystem.CATEGORIES ? (
<div className="relative flex items-center gap-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const FilterEndDate = observer(function FilterEndDate(props: Props) {

const isCustomDateSelected = () => {
const isValidDateSelected = appliedFilters?.filter((f) => isInDateFormat(f.split(";")[0])) || [];
return isValidDateSelected.length > 0 ? true : false;
return isValidDateSelected.length > 0;
};
const handleCustomDate = () => {
if (isCustomDateSelected()) {
Expand Down Expand Up @@ -64,7 +64,7 @@ export const FilterEndDate = observer(function FilterEndDate(props: Props) {
{filteredOptions.map((option) => (
<FilterOption
key={option.value}
isChecked={appliedFilters?.includes(option.value) ? true : false}
isChecked={appliedFilters?.includes(option.value)}
onClick={() => handleUpdate(option.value)}
title={option.name}
multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const FilterStartDate = observer(function FilterStartDate(props: Props) {

const isCustomDateSelected = () => {
const isValidDateSelected = appliedFilters?.filter((f) => isInDateFormat(f.split(";")[0])) || [];
return isValidDateSelected.length > 0 ? true : false;
return isValidDateSelected.length > 0;
};
const handleCustomDate = () => {
if (isCustomDateSelected()) {
Expand Down Expand Up @@ -65,7 +65,7 @@ export const FilterStartDate = observer(function FilterStartDate(props: Props) {
{filteredOptions.map((option) => (
<FilterOption
key={option.value}
isChecked={appliedFilters?.includes(option.value) ? true : false}
isChecked={appliedFilters?.includes(option.value)}
onClick={() => handleUpdate(option.value)}
title={option.name}
multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const FilterStatus = observer(function FilterStatus(props: Props) {
filteredOptions.map((status) => (
<FilterOption
key={status.value}
isChecked={appliedFilters?.includes(status.value) ? true : false}
isChecked={appliedFilters?.includes(status.value)}
onClick={() => handleUpdate(status.value)}
title={t(status.i18n_title)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const CycleOptions = observer(function CycleOptions(props: CycleOptionsPr
const cycleIds = (getProjectCycleIds(projectId) ?? [])?.filter((cycleId) => {
const cycleDetails = getCycleById(cycleId);
if (currentCycleId && currentCycleId === cycleId) return false;
return cycleDetails?.status ? (cycleDetails?.status.toLowerCase() != "completed" ? true : false) : true;
return cycleDetails?.status ? cycleDetails?.status.toLowerCase() != "completed" : true;
});

const onOpen = () => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/core/components/estimates/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ export const EstimateRoot = observer(function EstimateRoot(props: TEstimateRoot)
workspaceSlug={workspaceSlug}
projectId={projectId}
estimateId={estimateToUpdate ? estimateToUpdate : undefined}
isOpen={estimateToUpdate ? true : false}
isOpen={!!estimateToUpdate}
handleClose={() => setEstimateToUpdate(undefined)}
/>
<DeleteEstimateModal
workspaceSlug={workspaceSlug}
projectId={projectId}
estimateId={estimateToDelete ? estimateToDelete : undefined}
isOpen={estimateToDelete ? true : false}
isOpen={!!estimateToDelete}
handleClose={() => setEstimateToDelete(undefined)}
/>
</>
Expand Down
Loading
Loading