Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions apps/mobile/src/features/home/HomeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
type HomeListFilterMenuProject,
} from "./home-list-filter-menu";
import {
DEFAULT_OWNERSHIP_FILTER,
hasCustomHomeListOptions,
OWNERSHIP_FILTER_LABELS,
OWNERSHIP_FILTERS,
Expand Down Expand Up @@ -116,7 +117,7 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
const alternateModes = otherHomeListModes(props.listMode);
const hasCustomListOptions =
props.selectedEnvironmentIds.length > 0 ||
props.ownershipFilter !== "any" ||
props.ownershipFilter !== DEFAULT_OWNERSHIP_FILTER ||
props.ownershipRelation !== "both" ||
props.selectedProjectKey !== null ||
(props.listMode === "threads" &&
Expand Down Expand Up @@ -448,7 +449,7 @@ function IosHomeHeader(props: HomeHeaderProps) {
const useSolidBoardHeader = isBoardMode && NATIVE_LIQUID_GLASS_SUPPORTED;
const hasCustomListOptions =
props.selectedEnvironmentIds.length > 0 ||
props.ownershipFilter !== "any" ||
props.ownershipFilter !== DEFAULT_OWNERSHIP_FILTER ||
props.ownershipRelation !== "both" ||
props.selectedProjectKey !== null ||
(props.listMode === "threads" &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function baseProps(
projects: [],
selectedEnvironmentIds: [],
selectedProjectKey: null,
ownershipFilter: "any",
ownershipFilter: "mine",
ownershipRelation: "both",
projectSortOrder: "updated_at",
threadSortOrder: "updated_at",
Expand Down
10 changes: 7 additions & 3 deletions apps/mobile/src/features/home/home-list-options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import {
} from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";

import { hasCustomHomeListOptions, type HomeListOptions } from "./home-list-options";
import {
DEFAULT_OWNERSHIP_FILTER,
hasCustomHomeListOptions,
type HomeListOptions,
} from "./home-list-options";

const defaults: HomeListOptions = {
selectedEnvironmentIds: [],
ownershipFilter: "any",
ownershipFilter: DEFAULT_OWNERSHIP_FILTER,
ownershipRelation: "both",
listMode: "threads",
threadGrouping: "project",
Expand Down Expand Up @@ -37,7 +41,7 @@ describe("home list options", () => {
});

it("marks ownership filters as customized", () => {
expect(hasCustomHomeListOptions({ ...defaults, ownershipFilter: "mine" })).toBe(true);
expect(hasCustomHomeListOptions({ ...defaults, ownershipFilter: "any" })).toBe(true);
expect(hasCustomHomeListOptions({ ...defaults, ownershipFilter: "theirs" })).toBe(true);
expect(hasCustomHomeListOptions({ ...defaults, ownershipRelation: "created" })).toBe(true);
});
Expand Down
7 changes: 5 additions & 2 deletions apps/mobile/src/features/home/home-list-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ export const THREAD_SORT_OPTIONS: ReadonlyArray<{
{ value: "created_at", label: "Created at" },
];

/** Default ownership filter: Mine (created or participated, plus unattributed). */
export const DEFAULT_OWNERSHIP_FILTER: OwnershipFilter = "mine";

function defaultHomeListOptions(): HomeListOptions {
return {
selectedEnvironmentIds: [],
ownershipFilter: "any",
ownershipFilter: DEFAULT_OWNERSHIP_FILTER,
ownershipRelation: DEFAULT_OWNERSHIP_RELATION,
listMode: DEFAULT_HOME_LIST_MODE,
threadGrouping: DEFAULT_HOME_THREAD_GROUPING,
Expand Down Expand Up @@ -291,7 +294,7 @@ export function hasCustomHomeListOptions(
: DEFAULT_SIDEBAR_PROJECT_SORT_ORDER;
return (
options.selectedEnvironmentIds.length > 0 ||
options.ownershipFilter !== "any" ||
options.ownershipFilter !== DEFAULT_OWNERSHIP_FILTER ||
options.ownershipRelation !== DEFAULT_OWNERSHIP_RELATION ||
(options.selectedProjectKey !== null && options.selectedProjectKey !== undefined) ||
options.threadGrouping !== DEFAULT_HOME_THREAD_GROUPING ||
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { useSavedRemoteConnections } from "../../state/use-remote-environment-re
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
import { BoardScreen } from "../board/BoardScreen";
import {
DEFAULT_OWNERSHIP_FILTER,
hasCustomHomeListOptions,
PROJECT_SORT_OPTIONS,
THREAD_SORT_OPTIONS,
Expand Down Expand Up @@ -1339,7 +1340,7 @@ function ThreadNavigationSidebarPane(
// light the "customized" state (sort options are hidden).
const filterCustomized =
options.selectedEnvironmentIds.length > 0 ||
options.ownershipFilter !== "any" ||
options.ownershipFilter !== DEFAULT_OWNERSHIP_FILTER ||
options.ownershipRelation !== "both" ||
selectedProjectKey !== null ||
options.threadGrouping !== "project" ||
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/persistence/mobile-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function sanitizePreferences(parsed: Preferences): Preferences {
return preferences;
}

/** Resolve stored ownership filter; default anyone when never chosen. */
/** Resolve stored ownership filter; default Mine when never chosen. */
export function resolveOwnershipFilter(preferences: Preferences): "any" | "mine" | "theirs" {
if (
preferences.ownershipFilter === "any" ||
Expand All @@ -208,7 +208,7 @@ export function resolveOwnershipFilter(preferences: Preferences): "any" | "mine"
) {
return preferences.ownershipFilter;
}
return "any";
return "mine";
}

/** Resolve mine/theirs relation sub-filter; default both. */
Expand Down
Loading
Loading