mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
chore: Prune stale comments, TODOs, and type suppressions (#14092)
* chore: Remove unused lint disable directives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Replace TODO type suppressions with typed code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Remove obsolete workaround comments in tests and MediaDimension Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Remove Tippy compatibility props from Tooltip Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Decouple DropdownMenu props from Tooltip and clarify sharing styles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Remove stale retention TODOs from cleanup tasks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Register relations synchronously and clarify workaround comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH * chore: Replace Notion import TODOs with descriptive comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
08b3896cfc
commit
9e2565184e
97 files changed
+133
-279
No files matched your search
@@ -1,20 +0,0 @@
|
||||
const storage = {};
|
||||
|
||||
export default {
|
||||
setItem: function (key, value) {
|
||||
storage[key] = value || "";
|
||||
},
|
||||
getItem: function (key) {
|
||||
return key in storage ? storage[key] : null;
|
||||
},
|
||||
removeItem: function (key) {
|
||||
delete storage[key];
|
||||
},
|
||||
get length() {
|
||||
return Object.keys(storage).length;
|
||||
},
|
||||
key: function (i) {
|
||||
var keys = Object.keys(storage);
|
||||
return keys[i] || null;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
const storage: Record<string, string> = {};
|
||||
|
||||
const localStorage: Storage = {
|
||||
setItem(key: string, value: string) {
|
||||
storage[key] = value || "";
|
||||
},
|
||||
getItem(key: string) {
|
||||
return key in storage ? storage[key] : null;
|
||||
},
|
||||
removeItem(key: string) {
|
||||
delete storage[key];
|
||||
},
|
||||
clear() {
|
||||
Object.keys(storage).forEach((key) => delete storage[key]);
|
||||
},
|
||||
get length() {
|
||||
return Object.keys(storage).length;
|
||||
},
|
||||
key(i: number) {
|
||||
const keys = Object.keys(storage);
|
||||
return keys[i] || null;
|
||||
},
|
||||
};
|
||||
|
||||
export default localStorage;
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable react/prop-types */
|
||||
import { observer } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import type { Props as TooltipProps } from "~/components/Tooltip";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable prefer-rest-params */
|
||||
/* global ga */
|
||||
import { escape } from "es-toolkit/compat";
|
||||
import * as React from "react";
|
||||
|
||||
@@ -82,7 +82,7 @@ function AvatarWithPresence({
|
||||
// real user, there's no profile to show for it.
|
||||
if (!(user instanceof User)) {
|
||||
return (
|
||||
<Tooltip content={<Centered>{name}</Centered>} placement="bottom">
|
||||
<Tooltip content={<Centered>{name}</Centered>} side="bottom">
|
||||
{avatar}
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
@@ -223,7 +223,7 @@ function DocumentListItem(props: Props) {
|
||||
{document.isDraft &&
|
||||
showDraft &&
|
||||
(isInteractive ? (
|
||||
<Tooltip content={t("Only visible to you")} placement="top">
|
||||
<Tooltip content={t("Only visible to you")}>
|
||||
<Badge>{t("Draft")}</Badge>
|
||||
</Tooltip>
|
||||
) : (
|
||||
|
||||
@@ -789,7 +789,7 @@ function Lightbox({ images, activeImage, onUpdate, onClose, readOnly }: Props) {
|
||||
animation={animation.current}
|
||||
$commentsOpen={canShowComments && commentsOpen}
|
||||
>
|
||||
<Tooltip content={t("Zoom in")} placement="bottom">
|
||||
<Tooltip content={t("Zoom in")} side="bottom">
|
||||
<ActionButton
|
||||
tabIndex={-1}
|
||||
disabled={
|
||||
@@ -808,7 +808,7 @@ function Lightbox({ images, activeImage, onUpdate, onClose, readOnly }: Props) {
|
||||
neutral
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip content={t("Zoom out")} placement="bottom">
|
||||
<Tooltip content={t("Zoom out")} side="bottom">
|
||||
<ActionButton
|
||||
tabIndex={-1}
|
||||
disabled={
|
||||
@@ -830,7 +830,7 @@ function Lightbox({ images, activeImage, onUpdate, onClose, readOnly }: Props) {
|
||||
/>
|
||||
</Tooltip>
|
||||
<Separator />
|
||||
<Tooltip content={t("Copy link")} placement="bottom">
|
||||
<Tooltip content={t("Copy link")} side="bottom">
|
||||
<CopyToClipboard text={imgRef.current?.src ?? ""}>
|
||||
<ActionButton
|
||||
tabIndex={-1}
|
||||
@@ -843,7 +843,7 @@ function Lightbox({ images, activeImage, onUpdate, onClose, readOnly }: Props) {
|
||||
/>
|
||||
</CopyToClipboard>
|
||||
</Tooltip>
|
||||
<Tooltip content={t("Download")} placement="bottom">
|
||||
<Tooltip content={t("Download")} side="bottom">
|
||||
<ActionButton
|
||||
tabIndex={-1}
|
||||
disabled={status.image === ImageStatus.ERROR}
|
||||
@@ -858,7 +858,7 @@ function Lightbox({ images, activeImage, onUpdate, onClose, readOnly }: Props) {
|
||||
{activeImage.source === ImageSource.DiagramsNet &&
|
||||
!Desktop.isElectron() &&
|
||||
!readOnly && (
|
||||
<Tooltip content={t("Edit diagram")} placement="bottom">
|
||||
<Tooltip content={t("Edit diagram")} side="bottom">
|
||||
<ActionButton
|
||||
tabIndex={-1}
|
||||
disabled={status.image === ImageStatus.ERROR}
|
||||
@@ -872,7 +872,7 @@ function Lightbox({ images, activeImage, onUpdate, onClose, readOnly }: Props) {
|
||||
</Tooltip>
|
||||
)}
|
||||
{canShowComments && (
|
||||
<Tooltip content={t("Comments")} placement="bottom">
|
||||
<Tooltip content={t("Comments")} side="bottom">
|
||||
<ActionButton
|
||||
tabIndex={-1}
|
||||
onClick={() => setCommentsOpen((open) => !open)}
|
||||
@@ -888,7 +888,7 @@ function Lightbox({ images, activeImage, onUpdate, onClose, readOnly }: Props) {
|
||||
</Actions>
|
||||
<CloseAction animation={animation.current}>
|
||||
<Dialog.Close asChild>
|
||||
<Tooltip content={t("Close")} shortcut="Esc" placement="bottom">
|
||||
<Tooltip content={t("Close")} shortcut="Esc" side="bottom">
|
||||
<ActionButton
|
||||
tabIndex={-1}
|
||||
onClick={close}
|
||||
|
||||
@@ -48,7 +48,7 @@ const LocaleTime: React.FC<Props> = ({
|
||||
tooltipContent
|
||||
)
|
||||
}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
{time}
|
||||
</Tooltip>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as React from "react";
|
||||
import type * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
||||
import styled from "styled-components";
|
||||
import Scrollable from "~/components/Scrollable";
|
||||
import {
|
||||
@@ -46,9 +45,7 @@ type Props = {
|
||||
onOpen?: () => void;
|
||||
/** Callback when menu is closed */
|
||||
onClose?: () => void;
|
||||
// TODO: Invert the dependency chain by forwarding dropdown ref and props to Tooltip component
|
||||
ref?: React.Ref<React.ComponentRef<typeof TooltipPrimitive.Trigger>>;
|
||||
} & React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>;
|
||||
} & Omit<React.ComponentProps<typeof MenuTrigger>, "children">;
|
||||
|
||||
export const DropdownMenu = observer(function DropdownMenu({
|
||||
ref,
|
||||
|
||||
@@ -150,7 +150,7 @@ const Reaction: React.FC<Props> = ({
|
||||
);
|
||||
|
||||
return tooltipContent ? (
|
||||
<Tooltip content={tooltipContent} placement="bottom">
|
||||
<Tooltip content={tooltipContent} side="bottom">
|
||||
{DisplayedEmoji}
|
||||
</Tooltip>
|
||||
) : (
|
||||
|
||||
@@ -57,7 +57,7 @@ const ReactionPicker: React.FC<Props> = ({ onSelect, className, size }) => {
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen} modal={true}>
|
||||
<Tooltip content={t("Add reaction")} placement="top">
|
||||
<Tooltip content={t("Add reaction")}>
|
||||
<PopoverTrigger>
|
||||
<NudeButton
|
||||
aria-label={t("Reaction picker")}
|
||||
|
||||
@@ -116,7 +116,7 @@ function InnerPublicAccess({ collection, share, ref }: Props) {
|
||||
}, [t]);
|
||||
|
||||
const copyButton = (
|
||||
<Tooltip content={t("Copy public link")} placement="top">
|
||||
<Tooltip content={t("Copy public link")}>
|
||||
<CopyToClipboard text={share?.url ?? ""} onCopy={handleCopied}>
|
||||
<NudeButton type="button" disabled={!share} style={{ marginRight: 3 }}>
|
||||
<CopyIcon color={theme.placeholder} size={18} />
|
||||
|
||||
@@ -131,7 +131,7 @@ function PublicAccess({ document, share, sharedParent, ref }: Props) {
|
||||
: (share?.url ?? "");
|
||||
|
||||
const copyButton = (
|
||||
<Tooltip content={t("Copy public link")} placement="top">
|
||||
<Tooltip content={t("Copy public link")}>
|
||||
<CopyToClipboard text={shareUrl} onCopy={handleCopied}>
|
||||
<NudeButton type="button" disabled={!share} style={{ marginRight: 3 }}>
|
||||
<CopyIcon color={theme.placeholder} size={18} />
|
||||
|
||||
@@ -30,7 +30,7 @@ export const AppearanceAction = observer(() => {
|
||||
content={
|
||||
resolvedTheme === "light" ? t("Switch to dark") : t("Switch to light")
|
||||
}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<Button
|
||||
icon={resolvedTheme === "light" ? <SunIcon /> : <MoonIcon />}
|
||||
@@ -63,7 +63,7 @@ export function SubscribeAction({
|
||||
return (
|
||||
<Action>
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<Tooltip content={t("Subscribe to updates")} placement="bottom">
|
||||
<Tooltip content={t("Subscribe to updates")} side="bottom">
|
||||
<PopoverTrigger>
|
||||
<Button
|
||||
icon={<SubscribeIcon />}
|
||||
|
||||
@@ -65,7 +65,7 @@ function AuthenticatedIsland({ document, share, compact }: Props) {
|
||||
<Tooltip
|
||||
content={t("Edit {{noun}}", { noun: document.noun })}
|
||||
shortcut="e"
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<IconButton
|
||||
as={Link}
|
||||
|
||||
@@ -31,7 +31,7 @@ export function CopyLinkButton({
|
||||
}, [onCopy, t]);
|
||||
|
||||
return (
|
||||
<Tooltip content={t("Copy link")} placement="top">
|
||||
<Tooltip content={t("Copy link")}>
|
||||
<CopyToClipboard text={url} onCopy={handleCopied}>
|
||||
<NudeButton type="button">
|
||||
<LinkIcon size={20} />
|
||||
|
||||
@@ -30,7 +30,6 @@ export const GroupMembersPopover = observer(({ group, children }: Props) => {
|
||||
|
||||
// `orderedData` is an observable dependency, it is what recomputes the list
|
||||
// when group membership changes in the store.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const members = React.useMemo(
|
||||
() => groupUsers.inGroup(group.id),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
||||
@@ -218,7 +218,7 @@ function ShareSettingsPopover({ share, children }: Props) {
|
||||
|
||||
return (
|
||||
<Popover modal onOpenChange={handleOpenChange}>
|
||||
<Tooltip content={t("Display settings")} placement="top">
|
||||
<Tooltip content={t("Display settings")}>
|
||||
<PopoverTrigger>
|
||||
{children ?? (
|
||||
<SettingsTrigger type="button">
|
||||
|
||||
@@ -153,7 +153,6 @@ export const Suggestions = observer(function Suggestions({
|
||||
return {
|
||||
title: suggestion.name,
|
||||
subtitle: (
|
||||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
||||
<span onClick={(ev) => ev.stopPropagation()}>
|
||||
<GroupMembersPopover group={suggestion}>
|
||||
<StyledButtonLink>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Link } from "react-router-dom";
|
||||
|
||||
export { GroupMembersPopover } from "./GroupMembersPopover";
|
||||
|
||||
// TODO: Temp until Button/NudeButton styles are normalized
|
||||
// Highlights nude buttons within sharing popovers on hover or while expanded.
|
||||
export const Wrapper = styled.div`
|
||||
${NudeButton}:${hover},
|
||||
${NudeButton}[aria-expanded="true"] {
|
||||
|
||||
@@ -186,7 +186,7 @@ function CollectionRow({
|
||||
const menuElement = menuVisible ? (
|
||||
<Fade>
|
||||
{canCreateChild && (
|
||||
<Tooltip content={t("New doc")} delay={500}>
|
||||
<Tooltip content={t("New doc")}>
|
||||
<NudeButton
|
||||
aria-label={t("New nested document")}
|
||||
onClick={handleAddChild}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function DismissableSidebarAction({ id, ...rest }: Props) {
|
||||
{...rest}
|
||||
menu={
|
||||
<Fade>
|
||||
<Tooltip content={t("Hide")} delay={500}>
|
||||
<Tooltip content={t("Hide")}>
|
||||
<DismissButton aria-label={t("Hide")} onClick={handleDismiss}>
|
||||
<CloseIcon size={18} />
|
||||
</DismissButton>
|
||||
|
||||
@@ -95,7 +95,6 @@ export const Header: React.FC<Props> = ({
|
||||
hideOnActionDisabled
|
||||
tooltip={{
|
||||
content: resolve<string>(primaryAction.name, actionContext),
|
||||
delay: 500,
|
||||
}}
|
||||
>
|
||||
{resolve<React.ReactNode>(primaryAction.icon, actionContext)}
|
||||
|
||||
@@ -60,7 +60,6 @@ function Star({
|
||||
content: target.isStarred
|
||||
? t("Unstar document")
|
||||
: t("Star document"),
|
||||
delay: 500,
|
||||
}
|
||||
}
|
||||
action={
|
||||
|
||||
@@ -521,7 +521,7 @@ function ColumnVisibilityButton<TData>(props: ColumnVisibilityProps<TData>) {
|
||||
return (
|
||||
<MenuProvider variant="dropdown">
|
||||
<Menu>
|
||||
<Tooltip content={label} placement="bottom">
|
||||
<Tooltip content={label} side="bottom">
|
||||
<MenuTrigger aria-label={label}>
|
||||
<ColumnOptions>
|
||||
<SettingsIcon size={18} />
|
||||
|
||||
@@ -46,24 +46,6 @@ export type Props = {
|
||||
children?: React.ReactNode;
|
||||
/** Whether to disable the tooltip entirely */
|
||||
disabled?: boolean;
|
||||
/** Custom offset for the tooltip */
|
||||
offset?: [number, number];
|
||||
/** Placement prop for backward compatibility with Tippy */
|
||||
placement?:
|
||||
| "top"
|
||||
| "right"
|
||||
| "bottom"
|
||||
| "left"
|
||||
| "top-start"
|
||||
| "top-end"
|
||||
| "right-start"
|
||||
| "right-end"
|
||||
| "bottom-start"
|
||||
| "bottom-end"
|
||||
| "left-start"
|
||||
| "left-end";
|
||||
/** Delay prop for backward compatibility with Tippy */
|
||||
delay?: number | [number, number];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -93,43 +75,11 @@ function Tooltip({
|
||||
disableHoverableContent = false,
|
||||
children,
|
||||
disabled = false,
|
||||
offset,
|
||||
placement,
|
||||
delay,
|
||||
...rest
|
||||
}: Props): React.ReactElement | null {
|
||||
const isMobile = useMobile();
|
||||
const isInProvider = useTooltipContext();
|
||||
|
||||
// Handle backward compatibility with Tippy props
|
||||
let finalSide = side;
|
||||
let finalAlign = align;
|
||||
let finalDelayDuration = delayDuration;
|
||||
let finalSideOffset = sideOffset;
|
||||
|
||||
// Convert placement prop to side/align for backward compatibility
|
||||
if (placement) {
|
||||
const [placementSide, placementAlign] = placement.split("-");
|
||||
finalSide = placementSide as "top" | "right" | "bottom" | "left";
|
||||
if (placementAlign) {
|
||||
finalAlign = placementAlign as "start" | "center" | "end";
|
||||
}
|
||||
}
|
||||
|
||||
// Handle delay prop for backward compatibility
|
||||
if (delay !== undefined) {
|
||||
if (typeof delay === "number") {
|
||||
finalDelayDuration = delay;
|
||||
} else if (Array.isArray(delay)) {
|
||||
finalDelayDuration = delay[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Handle offset prop for backward compatibility
|
||||
if (offset) {
|
||||
finalSideOffset = offset[1] || sideOffset;
|
||||
}
|
||||
|
||||
let content = <>{tooltip}</>;
|
||||
|
||||
if (!tooltip || isMobile || disabled) {
|
||||
@@ -164,15 +114,15 @@ function Tooltip({
|
||||
defaultOpen={defaultOpen}
|
||||
open={open}
|
||||
onOpenChange={onOpenChange}
|
||||
delayDuration={isInProvider ? undefined : finalDelayDuration}
|
||||
delayDuration={isInProvider ? undefined : delayDuration}
|
||||
disableHoverableContent={disableHoverableContent}
|
||||
>
|
||||
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
|
||||
<TooltipPrimitive.Portal>
|
||||
<StyledContent
|
||||
side={finalSide}
|
||||
sideOffset={finalSideOffset}
|
||||
align={finalAlign}
|
||||
side={side}
|
||||
sideOffset={sideOffset}
|
||||
align={align}
|
||||
alignOffset={alignOffset}
|
||||
avoidCollisions={avoidCollisions}
|
||||
collisionBoundary={collisionBoundary}
|
||||
@@ -193,7 +143,7 @@ function Tooltip({
|
||||
// Otherwise, wrap with a provider for standalone usage
|
||||
return (
|
||||
<TooltipPrimitive.Provider
|
||||
delayDuration={finalDelayDuration}
|
||||
delayDuration={delayDuration}
|
||||
skipDelayDuration={skipDelayDuration}
|
||||
>
|
||||
{tooltipContent}
|
||||
|
||||
@@ -15,11 +15,6 @@ type Props = {
|
||||
skipDelayDuration?: number;
|
||||
/** Prevents the tooltip from opening */
|
||||
disableHoverableContent?: boolean;
|
||||
/** Props to pass to the Tippy component - kept for backward compatibility */
|
||||
tippyProps?: {
|
||||
delay?: number;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -30,14 +25,10 @@ export function TooltipProvider({
|
||||
delayDuration = 500,
|
||||
skipDelayDuration = 300,
|
||||
disableHoverableContent = false,
|
||||
tippyProps,
|
||||
}: Props) {
|
||||
// Handle backward compatibility with tippyProps
|
||||
const finalDelayDuration = tippyProps?.delay ?? delayDuration;
|
||||
|
||||
return (
|
||||
<TooltipPrimitive.Provider
|
||||
delayDuration={finalDelayDuration}
|
||||
delayDuration={delayDuration}
|
||||
skipDelayDuration={skipDelayDuration}
|
||||
disableHoverableContent={disableHoverableContent}
|
||||
>
|
||||
|
||||
@@ -319,7 +319,7 @@ function MenuButton(props: MenuButtonProps) {
|
||||
);
|
||||
|
||||
return tooltip ? (
|
||||
<Tooltip content={tooltip} placement="bottom">
|
||||
<Tooltip content={tooltip} side="bottom">
|
||||
<div>{button}</div>
|
||||
</Tooltip>
|
||||
) : (
|
||||
|
||||
@@ -411,7 +411,7 @@ export default function FindAndReplace({
|
||||
<Tooltip
|
||||
content={t("Previous match")}
|
||||
shortcut="Shift+Enter"
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<ButtonLarge
|
||||
disabled={disabled}
|
||||
@@ -424,7 +424,7 @@ export default function FindAndReplace({
|
||||
<CaretUpIcon />
|
||||
</ButtonLarge>
|
||||
</Tooltip>
|
||||
<Tooltip content={t("Next match")} shortcut="Enter" placement="bottom">
|
||||
<Tooltip content={t("Next match")} shortcut="Enter" side="bottom">
|
||||
<ButtonLarge
|
||||
disabled={disabled}
|
||||
onClick={() => {
|
||||
@@ -440,7 +440,7 @@ export default function FindAndReplace({
|
||||
<Tooltip
|
||||
content={t("Replace options")}
|
||||
shortcut={`${altDisplay}+${metaDisplay}+f`}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<ButtonLarge onClick={handleMore} aria-label={t("Replace options")}>
|
||||
<ReplaceIcon color={theme.textSecondary} />
|
||||
@@ -489,7 +489,7 @@ export default function FindAndReplace({
|
||||
<Tooltip
|
||||
content={t("Match case")}
|
||||
shortcut={`${altDisplay}+${metaDisplay}+c`}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<ButtonSmall
|
||||
onClick={handleCaseSensitive}
|
||||
@@ -503,7 +503,7 @@ export default function FindAndReplace({
|
||||
<Tooltip
|
||||
content={t("Enable regex")}
|
||||
shortcut={`${altDisplay}+${metaDisplay}+r`}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<ButtonSmall
|
||||
onClick={handleRegex}
|
||||
@@ -538,11 +538,7 @@ export default function FindAndReplace({
|
||||
onRequestSubmit={handleReplaceAll}
|
||||
onChange={(ev) => setReplaceTerm(ev.currentTarget.value)}
|
||||
/>
|
||||
<Tooltip
|
||||
content={t("Replace")}
|
||||
shortcut="Enter"
|
||||
placement="bottom"
|
||||
>
|
||||
<Tooltip content={t("Replace")} shortcut="Enter" side="bottom">
|
||||
<Button onClick={handleReplace} disabled={disabled} neutral>
|
||||
{t("Replace")}
|
||||
</Button>
|
||||
@@ -550,7 +546,7 @@ export default function FindAndReplace({
|
||||
<Tooltip
|
||||
content={t("Replace all")}
|
||||
shortcut={`${metaDisplay}+Enter`}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<Button
|
||||
onClick={handleReplaceAll}
|
||||
|
||||
@@ -248,7 +248,7 @@ export function MediaDimension() {
|
||||
};
|
||||
}, [nodeType]);
|
||||
|
||||
// hacky debounce for checking error.
|
||||
// Debounce validation so errors are not shown while typing.
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
const isWidthError = localDimension.width
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// oxlint-disable-next-line import/no-unresolved
|
||||
import "vite/modulepreload-polyfill";
|
||||
// Keep ahead of the other imports so polyfills apply before they evaluate.
|
||||
import "~/utils/polyfills";
|
||||
|
||||
@@ -74,7 +74,7 @@ function NewChildDocumentMenu({ document }: Props) {
|
||||
const rootAction = useMenuAction(actions);
|
||||
|
||||
return (
|
||||
<Tooltip content={t("New document")} shortcut="n" placement="bottom">
|
||||
<Tooltip content={t("New document")} shortcut="n" side="bottom">
|
||||
<DropdownMenu
|
||||
action={rootAction}
|
||||
align="end"
|
||||
|
||||
@@ -19,7 +19,7 @@ function NewDocumentMenu() {
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip content={t("New document")} shortcut="n" placement="bottom">
|
||||
<Tooltip content={t("New document")} shortcut="n" side="bottom">
|
||||
<Button
|
||||
as={Link}
|
||||
to={newDocumentPath()}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable */
|
||||
import stores from "~/stores";
|
||||
|
||||
describe("Collection model", () => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable */
|
||||
import { autorun, isAction, isObservableProp } from "mobx";
|
||||
import stores from "~/stores";
|
||||
|
||||
|
||||
@@ -232,15 +232,13 @@ export default abstract class Model {
|
||||
if (key === "initialized") {
|
||||
continue;
|
||||
}
|
||||
// @ts-expect-error TODO
|
||||
if (isEqual(toJS(this[key]), data[key])) {
|
||||
if (isEqual(toJS(Reflect.get(this, key)), data[key])) {
|
||||
continue;
|
||||
}
|
||||
// A field declared without a default does not exist until it is first
|
||||
// assigned, so MobX could not annotate it when the model was created.
|
||||
addedKeys ||= !(key in this);
|
||||
// @ts-expect-error TODO
|
||||
this[key] = data[key];
|
||||
Reflect.set(this, key, data[key]);
|
||||
} catch (error) {
|
||||
Logger.warn(`Error setting ${key} on model`, { error });
|
||||
}
|
||||
|
||||
@@ -91,24 +91,17 @@ export default function Relation<T extends typeof Model>(
|
||||
? `${String(singular(propertyKey))}Ids`
|
||||
: `${String(propertyKey)}Id`;
|
||||
|
||||
// If the relation has options provided then register them in a map for later lookup. We can use
|
||||
// this to determine how to update relations when a model is deleted.
|
||||
//
|
||||
// TODO: requestAnimationFrame is a temporary solution to a bug in rolldown compiled code that
|
||||
// will place static methods _after_ decorators. Temporary fix is to delay the registration until
|
||||
// the next frame.
|
||||
const modelName = (target.constructor as typeof Model).modelName;
|
||||
requestAnimationFrame(() => {
|
||||
if (options) {
|
||||
const configForClass = relations.get(modelName) ?? new Map();
|
||||
configForClass.set(propertyKey, {
|
||||
options,
|
||||
relationClassResolver: classResolver,
|
||||
idKey,
|
||||
});
|
||||
relations.set(modelName, configForClass);
|
||||
}
|
||||
});
|
||||
// Register relation options to determine how to update relations when a model is deleted.
|
||||
if (options) {
|
||||
const modelName = (target.constructor as typeof Model).modelName;
|
||||
const configForClass = relations.get(modelName) ?? new Map();
|
||||
configForClass.set(propertyKey, {
|
||||
options,
|
||||
relationClassResolver: classResolver,
|
||||
idKey,
|
||||
});
|
||||
relations.set(modelName, configForClass);
|
||||
}
|
||||
|
||||
Object.defineProperty(target, propertyKey, {
|
||||
get() {
|
||||
|
||||
@@ -61,11 +61,7 @@ function Actions({ collection, isEditing, sidebarContext }: Props) {
|
||||
{!isEditing && user?.separateEditMode && (
|
||||
<Action>
|
||||
<RegisterKeyDown trigger="e" handler={goToEdit} />
|
||||
<Tooltip
|
||||
content={t("Edit collection")}
|
||||
shortcut="e"
|
||||
placement="bottom"
|
||||
>
|
||||
<Tooltip content={t("Edit collection")} shortcut="e" side="bottom">
|
||||
<Button icon={<EditIcon />} onClick={goToEdit} neutral>
|
||||
{t("Edit")}
|
||||
</Button>
|
||||
@@ -80,7 +76,7 @@ function Actions({ collection, isEditing, sidebarContext }: Props) {
|
||||
)}
|
||||
{can.createDocument && (
|
||||
<Action>
|
||||
<Tooltip content={t("New document")} shortcut="n" placement="bottom">
|
||||
<Tooltip content={t("New document")} shortcut="n" side="bottom">
|
||||
<Button
|
||||
as={Link}
|
||||
to={collection ? newDocumentPath(collection.id) : ""}
|
||||
|
||||
@@ -52,7 +52,7 @@ export const CollectionMeta = observer(function CollectionMeta_({
|
||||
? t("Only members with access can view")
|
||||
: t("All members in the workspace can view")
|
||||
}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<IconLabel align="center">
|
||||
{collection.isPrivate ? (
|
||||
@@ -66,10 +66,7 @@ export const CollectionMeta = observer(function CollectionMeta_({
|
||||
{isPubliclyShared && (
|
||||
<>
|
||||
<Separator />
|
||||
<Tooltip
|
||||
content={t("Anyone with the link can view")}
|
||||
placement="bottom"
|
||||
>
|
||||
<Tooltip content={t("Anyone with the link can view")} side="bottom">
|
||||
<IconLabel align="center">
|
||||
<GlobeIcon size={18} />
|
||||
{t("Publicly shared")}
|
||||
|
||||
@@ -91,7 +91,7 @@ const MembershipPreview = ({ collection, limit = 8 }: Props) => {
|
||||
groupsCount,
|
||||
count: groupsCount,
|
||||
}),
|
||||
delay: 250,
|
||||
delayDuration: 250,
|
||||
}}
|
||||
width="auto"
|
||||
height="auto"
|
||||
|
||||
@@ -39,7 +39,7 @@ export const ChangesNavigation = observer(function ChangesNavigation_() {
|
||||
count: totalChanges,
|
||||
})}
|
||||
</NavigationLabel>
|
||||
<Tooltip content={t("Previous change")} placement="bottom">
|
||||
<Tooltip content={t("Previous change")} side="bottom">
|
||||
<NavigationButton
|
||||
icon={<CaretUpIcon />}
|
||||
onClick={() => editor?.commands.prevChange()}
|
||||
@@ -47,7 +47,7 @@ export const ChangesNavigation = observer(function ChangesNavigation_() {
|
||||
aria-label={t("Previous change")}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Tooltip content={t("Next change")} placement="bottom">
|
||||
<Tooltip content={t("Next change")} side="bottom">
|
||||
<NavigationButton
|
||||
icon={<CaretDownIcon />}
|
||||
onClick={() => editor?.commands.nextChange()}
|
||||
|
||||
@@ -411,7 +411,7 @@ function CommentForm({
|
||||
{t("Cancel")}
|
||||
</ButtonSmall>
|
||||
</HStack>
|
||||
<Tooltip content={t("Upload image")} placement="top">
|
||||
<Tooltip content={t("Upload image")}>
|
||||
<NudeButton onClick={handleImageUpload}>
|
||||
<ImageIcon color={theme.textTertiary} />
|
||||
</NudeButton>
|
||||
|
||||
@@ -317,7 +317,7 @@ const ResolveButton = ({
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Tooltip content={t("Mark as resolved")} placement="top">
|
||||
<Tooltip content={t("Mark as resolved")}>
|
||||
<Action
|
||||
as={NudeButton}
|
||||
action={resolveCommentActionFactory({
|
||||
|
||||
@@ -66,7 +66,7 @@ function ConnectionStatus() {
|
||||
</Centered>
|
||||
)
|
||||
}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<Fade>
|
||||
<Button width="auto">
|
||||
|
||||
@@ -121,7 +121,7 @@ function DocumentHeader({
|
||||
: `${t("Show contents")} (${t("available when headings are added")})`
|
||||
}
|
||||
shortcut={`Ctrl+${altDisplay}+h`}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<TocButton
|
||||
aria-label={t("Show contents")}
|
||||
@@ -139,7 +139,7 @@ function DocumentHeader({
|
||||
noun: document.noun,
|
||||
})}
|
||||
shortcut="e"
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<Button
|
||||
as={Link}
|
||||
@@ -224,7 +224,7 @@ function DocumentHeader({
|
||||
<Tooltip
|
||||
content={isDraft ? t("Save draft") : t("Done editing")}
|
||||
shortcut={`${metaDisplay}+enter`}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
@@ -257,7 +257,7 @@ function DocumentHeader({
|
||||
<ChangesNavigation />
|
||||
</Action>
|
||||
<Action>
|
||||
<Tooltip content={t("Restore version")} placement="bottom">
|
||||
<Tooltip content={t("Restore version")} side="bottom">
|
||||
<Button
|
||||
action={restoreRevision}
|
||||
disabled={revision.createdAt === document.updatedAt}
|
||||
|
||||
@@ -294,7 +294,7 @@ function PresentationMode({ title, icon, iconColor, data, onClose }: Props) {
|
||||
<Container ref={containerRef} $background={theme.background} $idle={isIdle}>
|
||||
<TopBar $idle={isIdle}>
|
||||
<Flex align="center" gap={12}>
|
||||
<Tooltip content={t("Previous slide")} delay={500}>
|
||||
<Tooltip content={t("Previous slide")}>
|
||||
<Button onClick={goPrev} disabled={currentSlide === 0}>
|
||||
<ArrowLeftIcon />
|
||||
</Button>
|
||||
@@ -302,7 +302,7 @@ function PresentationMode({ title, icon, iconColor, data, onClose }: Props) {
|
||||
<SlideCounter>
|
||||
{currentSlide + 1} / {totalSlides}
|
||||
</SlideCounter>
|
||||
<Tooltip content={t("Next slide")} delay={500}>
|
||||
<Tooltip content={t("Next slide")}>
|
||||
<Button
|
||||
onClick={goNext}
|
||||
disabled={currentSlide === totalSlides - 1}
|
||||
@@ -313,7 +313,7 @@ function PresentationMode({ title, icon, iconColor, data, onClose }: Props) {
|
||||
</Flex>
|
||||
<RightButtons>
|
||||
{supportsFullscreen && (
|
||||
<Tooltip content={t("Toggle fullscreen")} delay={500}>
|
||||
<Tooltip content={t("Toggle fullscreen")}>
|
||||
<Button onClick={toggleFullscreen}>
|
||||
{isFullscreen ? (
|
||||
<ShrinkIcon color="currentColor" />
|
||||
@@ -323,7 +323,7 @@ function PresentationMode({ title, icon, iconColor, data, onClose }: Props) {
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Tooltip content={t("Close")} delay={500}>
|
||||
<Tooltip content={t("Close")}>
|
||||
<Button onClick={onClose}>
|
||||
<CloseIcon />
|
||||
</Button>
|
||||
|
||||
@@ -27,11 +27,7 @@ export function SearchHighlightChip() {
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
content={t("Clear search highlight")}
|
||||
shortcut="Esc"
|
||||
placement="bottom"
|
||||
>
|
||||
<Tooltip content={t("Clear search highlight")} shortcut="Esc" side="bottom">
|
||||
<Chip
|
||||
type="button"
|
||||
onClick={handleClick}
|
||||
|
||||
@@ -92,7 +92,7 @@ function SharedDocumentHeader({ document }: Props) {
|
||||
: `${t("Show contents")} (${t("available when headings are added")})`
|
||||
}
|
||||
shortcut={`Ctrl+${altDisplay}+h`}
|
||||
placement="bottom"
|
||||
side="bottom"
|
||||
>
|
||||
<TocButton
|
||||
aria-label={t("Show contents")}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable react/no-unescaped-entities */
|
||||
import { WarningIcon } from "outline-icons";
|
||||
import { Trans } from "react-i18next";
|
||||
import Notice from "~/components/Notice";
|
||||
|
||||
@@ -292,7 +292,7 @@ const Application = observer(function Application({ oauthClient }: Props) {
|
||||
value={oauthClient.clientSecret}
|
||||
readOnly
|
||||
>
|
||||
<Tooltip content={t("Rotate secret")} placement="top">
|
||||
<Tooltip content={t("Rotate secret")}>
|
||||
<NudeButton type="button" onClick={handleRotateSecret}>
|
||||
<ReplaceIcon size={20} />
|
||||
</NudeButton>
|
||||
|
||||
@@ -90,7 +90,7 @@ function Features() {
|
||||
/>
|
||||
</Text>
|
||||
<Input readOnly value={mcpEndpoint}>
|
||||
<Tooltip content={t("Copy URL")} placement="top">
|
||||
<Tooltip content={t("Copy URL")}>
|
||||
<CopyToClipboard text={mcpEndpoint} onCopy={handleCopied}>
|
||||
<NudeButton type="button" style={{ marginRight: 3 }}>
|
||||
<CopyIcon color={theme.placeholder} size={18} />
|
||||
|
||||
@@ -43,7 +43,7 @@ export function CopyButton({
|
||||
}, [success]);
|
||||
|
||||
return (
|
||||
<Tooltip content={tooltip} placement="top">
|
||||
<Tooltip content={tooltip}>
|
||||
<CopyToClipboard text={value} onCopy={handleCopied}>
|
||||
<NudeButton type="button">{icon}</NudeButton>
|
||||
</CopyToClipboard>
|
||||
|
||||
@@ -98,7 +98,7 @@ function DomainManagement({ onSuccess }: Props) {
|
||||
onChange={createOnDomainChangedHandler(index)}
|
||||
/>
|
||||
<Remove>
|
||||
<Tooltip content={t("Remove domain")} placement="top">
|
||||
<Tooltip content={t("Remove domain")}>
|
||||
<NudeButton onClick={() => handleRemoveDomain(index)}>
|
||||
<CloseIcon />
|
||||
</NudeButton>
|
||||
|
||||
@@ -172,7 +172,7 @@ const TemplateLink = observer(({ template }: { template: Template }) => {
|
||||
<Text>{template.displayTitle}</Text>
|
||||
)}
|
||||
{template.isDraft && (
|
||||
<Tooltip content={t("Only visible to you")} placement="top">
|
||||
<Tooltip content={t("Only visible to you")}>
|
||||
<Badge>{t("Draft")}</Badge>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
@@ -35,7 +35,7 @@ function SharedCollection({ collection }: Props) {
|
||||
|
||||
const editAction = (
|
||||
<Action>
|
||||
<Tooltip content={t("Edit collection")} shortcut="e" placement="bottom">
|
||||
<Tooltip content={t("Edit collection")} shortcut="e" side="bottom">
|
||||
<Button
|
||||
as={Link}
|
||||
icon={<EditIcon />}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable */
|
||||
import stores from "~/stores";
|
||||
|
||||
describe("DocumentsStore", () => {
|
||||
|
||||
@@ -300,8 +300,7 @@ export default abstract class Store<T extends Model> {
|
||||
if (deleteBehavior === "cascade") {
|
||||
store.remove(item.id, options);
|
||||
} else if (deleteBehavior === "null") {
|
||||
// @ts-expect-error TODO
|
||||
item[relation.idKey] = null;
|
||||
Reflect.set(item, relation.idKey, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -349,8 +348,7 @@ export default abstract class Store<T extends Model> {
|
||||
if (archiveBehavior === "cascade") {
|
||||
store.addToArchive(item);
|
||||
} else if (archiveBehavior === "null") {
|
||||
// @ts-expect-error TODO
|
||||
item[relation.idKey] = null;
|
||||
Reflect.set(item, relation.idKey, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable */
|
||||
import "fake-indexeddb/auto";
|
||||
// The stores singleton must be imported before RootStore so that the module
|
||||
// cycle through AuthStore -> developer.ts -> ~/stores resolves in the same
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* oxlint-disable */
|
||||
import "reflect-metadata";
|
||||
import { vi } from "vitest";
|
||||
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '../.... Remove this comment to see the full error message
|
||||
import localStorage from "../../__mocks__/localStorage";
|
||||
import { initI18n } from "../utils/i18n";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable */
|
||||
import { vi } from "vitest";
|
||||
|
||||
export const client = {
|
||||
|
||||
+2
-9
@@ -108,20 +108,13 @@ export const uploadFile = async (
|
||||
xhr.setRequestHeader(key, value);
|
||||
}
|
||||
}
|
||||
// @ts-expect-error ts-migrate(2339) FIXME: Property 'blob' does not exist on type 'File | Blo...
|
||||
xhr.send(file.blob ? file.file : file);
|
||||
xhr.send(file);
|
||||
} else {
|
||||
const formData = new FormData();
|
||||
for (const key in data.form) {
|
||||
formData.append(key, data.form[key]);
|
||||
}
|
||||
// @ts-expect-error ts-migrate(2339) FIXME: Property 'blob' does not exist on type 'File | Blo...
|
||||
if (file.blob) {
|
||||
// @ts-expect-error ts-migrate(2339) FIXME: Property 'file' does not exist on type 'File | Blo...
|
||||
formData.append("file", file.file);
|
||||
} else {
|
||||
formData.append("file", file);
|
||||
}
|
||||
formData.append("file", file);
|
||||
|
||||
// Do not send credentials if uploading to a different origin, as the
|
||||
// combination of CORS and cookies will cause preflight request failure.
|
||||
|
||||
@@ -36,7 +36,7 @@ export function ImportDialog({ integrationId, onSubmit }: Props) {
|
||||
const handleStartImport = React.useCallback(async () => {
|
||||
setSubmitting();
|
||||
|
||||
// TODO: This can send the page info + permission once we overcome the search timeout issues.
|
||||
// Root pages are fetched on the server to avoid Notion search timeouts.
|
||||
const input: ImportInput<IntegrationService.Notion> = [{ permission }];
|
||||
|
||||
try {
|
||||
|
||||
@@ -98,7 +98,6 @@ export class NotionClient {
|
||||
let retries = 0;
|
||||
let serverErrorRetries = 0;
|
||||
|
||||
// oxlint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
try {
|
||||
await this.limiter();
|
||||
|
||||
@@ -45,8 +45,6 @@ export class NotionImportsProcessor extends ImportsProcessor<IntegrationService.
|
||||
|
||||
// App will send the default permission in an array with single item.
|
||||
const defaultPermission = importModel.input[0].permission;
|
||||
|
||||
// TODO: This update can be deleted when we receive the page info + permission from app.
|
||||
const importInput: NotionImportInput = rootPages.map((page) => ({
|
||||
type: page.type,
|
||||
externalId: page.id,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* oxlint-disable @typescript-eslint/explicit-function-return-type */
|
||||
import type { Tracer } from "dd-trace";
|
||||
|
||||
// oxlint-disable-next-line @typescript-eslint/no-empty-function
|
||||
const emptyFn = function () {};
|
||||
|
||||
const callableHandlers = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* oxlint-disable no-console */
|
||||
// oxlint-disable-next-line import/order
|
||||
import environment from "./utils/environment";
|
||||
import os from "node:os";
|
||||
import wellKnownServices from "nodemailer/lib/well-known/services.json";
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* oxlint-disable @typescript-eslint/no-misused-promises */
|
||||
/* oxlint-disable import/order */
|
||||
import "zod/compile";
|
||||
import "./logging/tracer"; // must come before importing any instrumented module
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ export function addTags(
|
||||
export function getRootSpanFromRequestContext(
|
||||
context: PrivateDatadogContext
|
||||
): Span | null {
|
||||
// oxlint-disable-next-line no-undef
|
||||
return context?.req?._datadog?.span ?? null;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,6 @@ const traceClass = (config?: TraceConfig) =>
|
||||
key
|
||||
);
|
||||
|
||||
// oxlint-disable-next-line no-undef
|
||||
if (typeof key === "string" && typeof descriptor?.value === "function") {
|
||||
Object.defineProperty(
|
||||
constructor.prototype,
|
||||
@@ -172,7 +171,6 @@ const traceClass = (config?: TraceConfig) =>
|
||||
staticKeys.forEach((key) => {
|
||||
const descriptor = Object.getOwnPropertyDescriptor(constructor, key);
|
||||
|
||||
// oxlint-disable-next-line no-undef
|
||||
if (typeof key === "string" && typeof descriptor?.value === "function") {
|
||||
Object.defineProperty(
|
||||
constructor,
|
||||
@@ -188,8 +186,6 @@ const traceClass = (config?: TraceConfig) =>
|
||||
*
|
||||
* @param config Optional configuration for the span that will be created for this trace.
|
||||
*/
|
||||
// Going to rely on inference to do its thing for this function
|
||||
// oxlint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export function trace(config?: TraceConfig) {
|
||||
function traceDecorator(target: Constructor): void;
|
||||
function traceDecorator<T>(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable @typescript-eslint/no-misused-promises */
|
||||
import http from "node:http";
|
||||
import https from "node:https";
|
||||
import type { AddressInfo } from "node:net";
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import type { Next } from "koa";
|
||||
import type { AppContext } from "@server/types";
|
||||
|
||||
// remove after https://github.com/koajs/koa-body/issues/218 is resolved
|
||||
/**
|
||||
* Ensures the request body is always an object, koa-body leaves it undefined
|
||||
* for requests with an unrecognized content type.
|
||||
*
|
||||
* @returns the middleware.
|
||||
*/
|
||||
export default function coalesceBody() {
|
||||
return function coalesceBodyMiddleware(ctx: AppContext, next: Next) {
|
||||
if (!ctx.request.body) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable lines-between-class-members */
|
||||
import fractionalIndex from "fractional-index";
|
||||
import { find, findIndex, isNil, keyBy, remove, uniq } from "es-toolkit/compat";
|
||||
import type {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable lines-between-class-members */
|
||||
import { compact, isNil, uniq } from "es-toolkit/compat";
|
||||
import type {
|
||||
Identifier,
|
||||
|
||||
@@ -163,7 +163,6 @@ class ShareSubscription extends IdModel<
|
||||
*/
|
||||
static normalizeEmailFingerprint(email: string): string {
|
||||
// Strip null bytes to prevent injection bypasses
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const lower = email.replace(/\0/g, "").toLowerCase().trim();
|
||||
const [localPart, domain] = lower.split("@");
|
||||
if (!localPart || !domain) {
|
||||
|
||||
@@ -532,8 +532,10 @@ class Model<
|
||||
) {
|
||||
const difference = Object.keys(previous)
|
||||
.concat(Object.keys(current))
|
||||
// @ts-expect-error TODO
|
||||
.filter((key) => !isEqual(previous[key], current[key]));
|
||||
.filter(
|
||||
(key) =>
|
||||
!isEqual(Reflect.get(previous, key), Reflect.get(current, key))
|
||||
);
|
||||
|
||||
previousAttributes[change] = pick(
|
||||
previous,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable @typescript-eslint/no-var-requires */
|
||||
import { find } from "es-toolkit/compat";
|
||||
import env from "@server/env";
|
||||
import type Team from "@server/models/Team";
|
||||
|
||||
@@ -130,7 +130,6 @@ function wrapInNativeError(err: any): Error {
|
||||
if (typeof err === "object") {
|
||||
try {
|
||||
errMsg = JSON.stringify(err);
|
||||
// oxlint-disable-next-line no-empty
|
||||
} catch (_err) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
@@ -371,13 +371,14 @@ export class CanCan {
|
||||
// Index for fast lookups: Map<model, Map<action, Ability[]>>
|
||||
private abilities: Map<Constructor, Map<string, Ability[]>> = new Map();
|
||||
|
||||
private get = <T extends object>(obj: T, key: keyof T) =>
|
||||
"get" in obj && typeof obj.get === "function" ? obj.get(key) : obj[key];
|
||||
private get = (obj: object, key: string): unknown =>
|
||||
"get" in obj && typeof obj.get === "function"
|
||||
? obj.get(key)
|
||||
: Reflect.get(obj, key);
|
||||
|
||||
private isPartiallyEqual = <T extends object>(target: T, obj: T) =>
|
||||
Object.keys(obj).every(
|
||||
// @ts-expect-error TODO
|
||||
(key: keyof T) => this.get(target, key) === obj[key]
|
||||
private isPartiallyEqual = (target: object, obj: object) =>
|
||||
Object.entries(obj).every(
|
||||
([key, value]) => this.get(target, key) === value
|
||||
);
|
||||
|
||||
private getConditionFn =
|
||||
|
||||
@@ -17,7 +17,7 @@ async function presentRevision(
|
||||
) {
|
||||
const { includeContent = true } = options;
|
||||
|
||||
// TODO: Remove this fallback once all revisions have been migrated
|
||||
// Older revisions may store the emoji icon as a prefix of the title.
|
||||
const { emoji, strippedTitle } = parseTitle(revision.title);
|
||||
|
||||
const [data, text, collaborators] = await Promise.all([
|
||||
|
||||
@@ -14,7 +14,6 @@ interface UnhealthyResult {
|
||||
extra: Record<string, string | number>;
|
||||
}
|
||||
|
||||
/* oxlint-disable @typescript-eslint/no-misused-promises */
|
||||
export default class HealthMonitor {
|
||||
/** The interval between health checks. */
|
||||
public static readonly checkInterval = 30 * Second.ms;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable @typescript-eslint/no-misused-promises */
|
||||
import Queue from "bull";
|
||||
import { snakeCase } from "es-toolkit/compat";
|
||||
import { toError } from "@shared/utils/error";
|
||||
|
||||
@@ -10,7 +10,6 @@ import { Minute } from "@shared/utils/time";
|
||||
|
||||
export default class CleanupOldEventsTask extends CronTask {
|
||||
public async perform({ partition }: Props) {
|
||||
// TODO: Hardcoded right now, configurable later
|
||||
const retentionDays = 365;
|
||||
const cutoffDate = subDays(new Date(), retentionDays);
|
||||
const maxEventsPerTask = 100000;
|
||||
|
||||
@@ -11,7 +11,6 @@ import { CronTask, TaskInterval } from "./base/CronTask";
|
||||
*/
|
||||
export default class CleanupOldImportsTask extends CronTask {
|
||||
public async perform() {
|
||||
// TODO: Hardcoded right now, configurable later
|
||||
const retentionDays = 1;
|
||||
const cutoffDate = subDays(new Date(), retentionDays);
|
||||
const maxImportsPerTask = 1000;
|
||||
|
||||
@@ -10,7 +10,6 @@ import { Minute } from "@shared/utils/time";
|
||||
|
||||
export default class CleanupOldSearchQueriesTask extends CronTask {
|
||||
public async perform({ partition }: Props) {
|
||||
// TODO: Hardcoded right now, configurable later
|
||||
const retentionDays = 365;
|
||||
const cutoffDate = subDays(new Date(), retentionDays);
|
||||
const maxSearchQueriesPerTask = 100000;
|
||||
|
||||
@@ -13,7 +13,6 @@ import { CronTask, TaskInterval } from "./base/CronTask";
|
||||
*/
|
||||
export default class ErrorTimedOutImportsTask extends CronTask {
|
||||
public async perform({ limit }: Props) {
|
||||
// TODO: Hardcoded right now, configurable later
|
||||
const thresholdHours = 24;
|
||||
const cutOffTime = subHours(new Date(), thresholdHours);
|
||||
const importsErrored: Record<string, boolean> = {};
|
||||
|
||||
@@ -5415,7 +5415,6 @@ describe("#documents.move", () => {
|
||||
|
||||
it("should move the document", async () => {
|
||||
const user = await buildUser();
|
||||
// const admin = await buildAdmin({ teamId: user.teamId });
|
||||
const document = await buildDocument({
|
||||
userId: user.id,
|
||||
teamId: user.teamId,
|
||||
|
||||
@@ -6,8 +6,7 @@ let page = parseInt(process.argv[2], 10);
|
||||
page = Number.isNaN(page) ? 0 : page;
|
||||
|
||||
export default async function main(exit = false) {
|
||||
// @ts-expect-error ts-migrate(7024) FIXME: Function implicitly has return type 'any' because ... Remove this comment to see the full error message
|
||||
const work = async (page: number) => {
|
||||
const work = async (page: number): Promise<void> => {
|
||||
console.log(`Backfill revision events… page ${page}`);
|
||||
const revisions = await Revision.findAll({
|
||||
limit,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable @typescript-eslint/no-var-requires */
|
||||
import { Server } from "node:https";
|
||||
import type { BaseContext } from "koa";
|
||||
import Koa from "koa";
|
||||
|
||||
@@ -409,15 +409,7 @@ export async function buildDraftDocument(
|
||||
}
|
||||
|
||||
export async function buildDocument(
|
||||
// Omission first, addition later?
|
||||
// This is actually a workaround to allow
|
||||
// passing collectionId as null. Ideally, it
|
||||
// should be updated in the Document model itself
|
||||
// but that'd cascade and require further changes
|
||||
// beyond the scope of what's required now
|
||||
overrides: Omit<Partial<Document>, "collectionId"> & { userId?: string } & {
|
||||
collectionId?: string | null;
|
||||
} = {}
|
||||
overrides: Partial<Document> & { userId?: string } = {}
|
||||
) {
|
||||
if (!overrides.teamId) {
|
||||
const team = await buildTeam();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable no-restricted-imports */
|
||||
// Vendored from request-filtering-agent v3.2.0 (MIT, by azu).
|
||||
// Source: https://github.com/azu/request-filtering-agent/blob/cc0f9fcb9e700cd4246db2ea36245439eede4096/src/request-filtering-agent.ts
|
||||
// License: see ./LICENSE.md
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable no-irregular-whitespace */
|
||||
import { lighten, transparentize } from "polished";
|
||||
import type { DefaultTheme } from "styled-components";
|
||||
import styled, { css, keyframes } from "styled-components";
|
||||
|
||||
@@ -4,7 +4,6 @@ import { keymap } from "prosemirror-keymap";
|
||||
import { MarkdownParser } from "prosemirror-markdown";
|
||||
import type { MarkSpec, NodeSpec, Schema } from "prosemirror-model";
|
||||
import type { EditorView } from "prosemirror-view";
|
||||
import type { Primitive } from "utility-types";
|
||||
import type { Editor } from "~/editor";
|
||||
import type Mark from "../marks/Mark";
|
||||
import type Node from "../nodes/Node";
|
||||
@@ -256,7 +255,7 @@ export default class ExtensionManager {
|
||||
.filter((extension) => extension.commands)
|
||||
.reduce((allCommands, extension) => {
|
||||
const { name } = extension;
|
||||
const commands: Record<string, CommandFactory> = {};
|
||||
const commands: Record<string, (attrs?: unknown) => void> = {};
|
||||
|
||||
let value: ReturnType<Extension["commands"]>;
|
||||
if (extension.type === "node") {
|
||||
@@ -269,10 +268,7 @@ export default class ExtensionManager {
|
||||
value = (extension as Extension).commands({ schema });
|
||||
}
|
||||
|
||||
const apply = (
|
||||
callback: CommandFactory,
|
||||
attrs: Record<string, Primitive>
|
||||
) => {
|
||||
const apply = (callback: CommandFactory, attrs: unknown) => {
|
||||
if (!view.editable && !extension.allowInReadOnly) {
|
||||
return;
|
||||
}
|
||||
@@ -300,8 +296,7 @@ export default class ExtensionManager {
|
||||
? _value
|
||||
: [_value];
|
||||
|
||||
// @ts-expect-error FIXME
|
||||
commands[_name] = (attrs: Record<string, Primitive>) =>
|
||||
commands[_name] = (attrs?: unknown) =>
|
||||
values.forEach((callback) => apply(callback, attrs));
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable @typescript-eslint/ban-ts-comment */
|
||||
// @ts-nocheck
|
||||
// https://raw.githubusercontent.com/ProseMirror/prosemirror-markdown/master/src/to_markdown.js
|
||||
// forked for table support
|
||||
@@ -323,7 +322,6 @@ export class MarkdownSerializerState {
|
||||
return info && info.expelEnclosingWhitespace;
|
||||
})
|
||||
) {
|
||||
// oxlint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
||||
const [, lead, inner, trail] = /^(\s*)(.*?)(\s*)$/m.exec(node.text);
|
||||
leading += lead;
|
||||
trailing = trail;
|
||||
|
||||
@@ -81,7 +81,6 @@ describe("Mention serialization", () => {
|
||||
{
|
||||
type: MentionType.Issue,
|
||||
label: "Epic 1",
|
||||
// oxlint-disable-next-line no-script-url
|
||||
href: "javascript:alert(1)",
|
||||
},
|
||||
{ commonMark: true }
|
||||
|
||||
@@ -127,7 +127,6 @@ function parseMentions(state: StateCore) {
|
||||
precToken.content = precToken.content.slice(0, -1);
|
||||
|
||||
// href must be present, otherwise the href test would've failed
|
||||
// oxlint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const href = openToken.attrs![0][1];
|
||||
const mentionToken = new state.Token("mention", "", 0);
|
||||
const externalUrl = isMentionHref(href)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable import/no-duplicates */
|
||||
import type { Locale } from "date-fns";
|
||||
import {
|
||||
addSeconds,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const ltrChars =
|
||||
"A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF";
|
||||
const rtlChars = "\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC";
|
||||
// oxlint-disable-next-line no-misleading-character-class
|
||||
const rtlDirCheck = new RegExp("^[^" + ltrChars + "]*[" + rtlChars + "]");
|
||||
|
||||
const rtlLanguageCodes = new Set(["ar", "fa", "he", "ps", "ur", "yi"]);
|
||||
|
||||
Reference in new issue
Block a user