mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 13:15:51 +08:00
chore: bump deps (#15059)
#### PR Dependency Tree * **PR #15059** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Configurable minimum account age before new accounts can invite members or create share links (default: 24 hours). * Sign-in now returns and caches user info for improved session handling. * **Bug Fixes** * Queue handling accepts and resolves job IDs with special characters. * Improved clipboard/rich-text caret handling and nested-list paste reliability. * Calendar tests use dynamic current-month dates. * AI search returns explicit "No matching documents" when none found. * Auth session responses are explicitly non-cacheable. * **Chores** * Dependency and toolchain bumps; admin UI config/schema exposes the new account-age setting. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
dragOverTitle,
|
||||
enterPlaygroundRoom,
|
||||
focusRichText,
|
||||
focusRichTextEnd,
|
||||
focusTitle,
|
||||
getClipboardHTML,
|
||||
getClipboardSnapshot,
|
||||
@@ -342,7 +343,7 @@ test(scoped`paste parent block`, async ({ page }) => {
|
||||
await type(page, 'This is child 2');
|
||||
await setInlineRangeInSelectedRichText(page, 0, 3);
|
||||
await copyByKeyboard(page);
|
||||
await focusRichText(page, 2);
|
||||
await focusRichTextEnd(page, 2);
|
||||
await page.keyboard.press(`${SHORT_KEY}+v`);
|
||||
await assertRichTexts(page, [
|
||||
'This is parent',
|
||||
@@ -363,7 +364,7 @@ test(scoped`clipboard copy multi selection`, async ({ page }) => {
|
||||
await waitNextFrame(page);
|
||||
await copyByKeyboard(page);
|
||||
await waitNextFrame(page);
|
||||
await focusRichText(page, 1);
|
||||
await focusRichTextEnd(page, 1);
|
||||
await pasteByKeyboard(page);
|
||||
await waitNextFrame(page);
|
||||
await type(page, 'cursor');
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
dragBetweenCoords,
|
||||
enterPlaygroundRoom,
|
||||
focusRichText,
|
||||
focusRichTextEnd,
|
||||
getAllNoteIds,
|
||||
getClipboardHTML,
|
||||
getClipboardSnapshot,
|
||||
@@ -192,7 +193,7 @@ test('paste a nested list to a nested list', async ({ page }) => {
|
||||
|
||||
// paste on end
|
||||
await undoByKeyboard(page);
|
||||
await page.keyboard.press('Control+ArrowRight');
|
||||
await focusRichTextEnd(page, 1);
|
||||
|
||||
/**
|
||||
* - aaa
|
||||
@@ -284,7 +285,7 @@ test('paste nested lists to a nested list', async ({ page }) => {
|
||||
|
||||
// paste on end
|
||||
await undoByKeyboard(page);
|
||||
await page.keyboard.press('Control+ArrowRight');
|
||||
await focusRichTextEnd(page, 1);
|
||||
|
||||
/**
|
||||
* - aaa
|
||||
|
||||
@@ -9,6 +9,28 @@ import {
|
||||
} from '../utils/actions/index.js';
|
||||
import { scoped, test } from '../utils/playwright.js';
|
||||
|
||||
const currentMonthAnchor = () => {
|
||||
const date = new Date();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
date.setDate(1);
|
||||
return date.getTime();
|
||||
};
|
||||
|
||||
const timestampFromMonthAnchor = ({
|
||||
monthAnchor,
|
||||
day,
|
||||
}: {
|
||||
monthAnchor: number;
|
||||
day: number;
|
||||
}) => {
|
||||
const date = new Date(monthAnchor);
|
||||
date.setDate(day);
|
||||
return date.getTime();
|
||||
};
|
||||
|
||||
const getMonthTimestamp = (page: Page, monthAnchor: number, day: number) =>
|
||||
page.evaluate(timestampFromMonthAnchor, { monthAnchor, day });
|
||||
|
||||
const createCalendarDatabase = async (
|
||||
page: Page,
|
||||
options?: {
|
||||
@@ -20,6 +42,10 @@ const createCalendarDatabase = async (
|
||||
withEndDateColumn?: boolean;
|
||||
}
|
||||
) => {
|
||||
const monthAnchor = await page.evaluate(currentMonthAnchor);
|
||||
const dateTimestamp = await getMonthTimestamp(page, monthAnchor, 15);
|
||||
const endDateTimestamp = await getMonthTimestamp(page, monthAnchor, 17);
|
||||
|
||||
return page.evaluate(
|
||||
({
|
||||
withDateColumn,
|
||||
@@ -28,6 +54,9 @@ const createCalendarDatabase = async (
|
||||
rowCount,
|
||||
linkedDocTitle,
|
||||
withEndDateColumn,
|
||||
dateTimestamp,
|
||||
endDateTimestamp,
|
||||
monthAnchor,
|
||||
}) => {
|
||||
const { doc } = window;
|
||||
const rows = rowCount ?? 1;
|
||||
@@ -93,20 +122,12 @@ const createCalendarDatabase = async (
|
||||
name: 'End Date',
|
||||
})
|
||||
: undefined;
|
||||
if (dateColumnId) {
|
||||
for (const id of rowIds) {
|
||||
datasource.cellValueChange(
|
||||
id,
|
||||
dateColumnId,
|
||||
new Date('2026-05-15T00:00:00').getTime()
|
||||
);
|
||||
if (endDateColumnId) {
|
||||
datasource.cellValueChange(
|
||||
id,
|
||||
endDateColumnId,
|
||||
new Date('2026-05-17T00:00:00').getTime()
|
||||
);
|
||||
}
|
||||
for (const id of rowIds) {
|
||||
if (dateColumnId) {
|
||||
datasource.cellValueChange(id, dateColumnId, dateTimestamp);
|
||||
}
|
||||
if (endDateColumnId) {
|
||||
datasource.cellValueChange(id, endDateColumnId, endDateTimestamp);
|
||||
}
|
||||
}
|
||||
const viewId = datasource.viewManager.viewAdd('calendar');
|
||||
@@ -135,9 +156,10 @@ const createCalendarDatabase = async (
|
||||
endDateColumnId,
|
||||
viewId,
|
||||
linkedDocId,
|
||||
monthAnchor,
|
||||
};
|
||||
},
|
||||
options ?? {}
|
||||
{ ...options, dateTimestamp, endDateTimestamp, monthAnchor }
|
||||
);
|
||||
};
|
||||
|
||||
@@ -212,9 +234,7 @@ test(scoped`database calendar creates row from empty day`, async ({ page }) => {
|
||||
|
||||
await expect(page.locator('affine-data-view-record-detail')).toBeVisible();
|
||||
|
||||
const expectedDate = await page.evaluate(() =>
|
||||
new Date('2026-05-20T00:00:00').getTime()
|
||||
);
|
||||
const expectedDate = await getMonthTimestamp(page, ids.monthAnchor, 20);
|
||||
await expect
|
||||
.poll(() =>
|
||||
page.evaluate(
|
||||
@@ -327,9 +347,7 @@ test(
|
||||
.first();
|
||||
await entry.dragTo(targetDay);
|
||||
|
||||
const expectedDate = await page.evaluate(() =>
|
||||
new Date('2026-05-20T00:00:00').getTime()
|
||||
);
|
||||
const expectedDate = await getMonthTimestamp(page, ids.monthAnchor, 20);
|
||||
await expect
|
||||
.poll(async () =>
|
||||
page.evaluate(({ databaseId, rowId, dateColumnId }) => {
|
||||
@@ -390,12 +408,8 @@ test(
|
||||
.first();
|
||||
await entry.dragTo(targetDay);
|
||||
|
||||
const expectedStart = await page.evaluate(() =>
|
||||
new Date('2026-05-20T00:00:00').getTime()
|
||||
);
|
||||
const expectedEnd = await page.evaluate(() =>
|
||||
new Date('2026-05-22T00:00:00').getTime()
|
||||
);
|
||||
const expectedStart = await getMonthTimestamp(page, ids.monthAnchor, 20);
|
||||
const expectedEnd = await getMonthTimestamp(page, ids.monthAnchor, 22);
|
||||
await expect
|
||||
.poll(() =>
|
||||
page.evaluate(
|
||||
@@ -456,9 +470,7 @@ test(scoped`database calendar resizes row range end date`, async ({ page }) => {
|
||||
await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y + 16);
|
||||
await page.mouse.up();
|
||||
|
||||
const expectedEnd = await page.evaluate(() =>
|
||||
new Date('2026-05-20T00:00:00').getTime()
|
||||
);
|
||||
const expectedEnd = await getMonthTimestamp(page, ids.monthAnchor, 20);
|
||||
await expect
|
||||
.poll(() =>
|
||||
page.evaluate(({ databaseId, rowId, endDateColumnId }) => {
|
||||
|
||||
@@ -667,7 +667,11 @@ export async function getInlineSelectionIndex(page: Page) {
|
||||
const selection = window.getSelection() as Selection;
|
||||
|
||||
const range = selection.getRangeAt(0);
|
||||
const component = range.startContainer.parentElement?.closest('rich-text');
|
||||
const startElement =
|
||||
range.startContainer instanceof Element
|
||||
? range.startContainer
|
||||
: range.startContainer.parentElement;
|
||||
const component = startElement?.closest('rich-text');
|
||||
const index = component?.inlineEditor?.getInlineRange()?.index;
|
||||
return index !== undefined ? index : -1;
|
||||
});
|
||||
@@ -677,7 +681,11 @@ export async function getInlineSelectionText(page: Page) {
|
||||
return page.evaluate(() => {
|
||||
const selection = window.getSelection() as Selection;
|
||||
const range = selection.getRangeAt(0);
|
||||
const component = range.startContainer.parentElement?.closest('rich-text');
|
||||
const startElement =
|
||||
range.startContainer instanceof Element
|
||||
? range.startContainer
|
||||
: range.startContainer.parentElement;
|
||||
const component = startElement?.closest('rich-text');
|
||||
return component?.inlineEditor?.yText.toString() ?? '';
|
||||
});
|
||||
}
|
||||
@@ -686,7 +694,11 @@ export async function getSelectedTextByInlineEditor(page: Page) {
|
||||
return page.evaluate(() => {
|
||||
const selection = window.getSelection() as Selection;
|
||||
const range = selection.getRangeAt(0);
|
||||
const component = range.startContainer.parentElement?.closest('rich-text');
|
||||
const startElement =
|
||||
range.startContainer instanceof Element
|
||||
? range.startContainer
|
||||
: range.startContainer.parentElement;
|
||||
const component = startElement?.closest('rich-text');
|
||||
|
||||
const inlineRange = component?.inlineEditor?.getInlineRange();
|
||||
if (!inlineRange) return '';
|
||||
@@ -736,12 +748,27 @@ export async function setInlineRangeInSelectedRichText(
|
||||
const selection = window.getSelection() as Selection;
|
||||
|
||||
const range = selection.getRangeAt(0);
|
||||
const component =
|
||||
range.startContainer.parentElement?.closest('rich-text');
|
||||
component?.inlineEditor?.setInlineRange({
|
||||
const startElement =
|
||||
range.startContainer instanceof Element
|
||||
? range.startContainer
|
||||
: range.startContainer.parentElement;
|
||||
const component = startElement?.closest('rich-text');
|
||||
const inlineEditor = component?.inlineEditor;
|
||||
if (!inlineEditor) {
|
||||
throw new Error('Cannot find inline editor from current selection');
|
||||
}
|
||||
component.focus();
|
||||
inlineEditor.setInlineRange({
|
||||
index,
|
||||
length,
|
||||
});
|
||||
const domRange = inlineEditor.toDomRange({ index, length });
|
||||
if (!domRange) {
|
||||
throw new Error('Cannot remap inline range to DOM range');
|
||||
}
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(domRange);
|
||||
document.dispatchEvent(new Event('selectionchange'));
|
||||
},
|
||||
{ index, length }
|
||||
);
|
||||
@@ -946,6 +973,7 @@ export async function setSelection(
|
||||
length: 0,
|
||||
})!;
|
||||
|
||||
anchorRichText.focus();
|
||||
const sl = getSelection();
|
||||
if (!sl) throw new Error('Cannot get selection');
|
||||
const range = document.createRange();
|
||||
@@ -959,6 +987,7 @@ export async function setSelection(
|
||||
);
|
||||
sl.removeAllRanges();
|
||||
sl.addRange(range);
|
||||
document.dispatchEvent(new Event('selectionchange'));
|
||||
},
|
||||
{
|
||||
anchorBlockId,
|
||||
|
||||
Reference in New Issue
Block a user