mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fixbug: [issue76]when click activities button, throw error;
This commit is contained in:
@@ -3,6 +3,7 @@ import { ServiceBaseClass } from '../base';
|
||||
import { ObserveCallback, ReturnUnobserve } from '../database';
|
||||
import { PageTree } from './page-tree';
|
||||
import { PageConfigItem } from './types';
|
||||
import { QueryIndexMetadata } from '@toeverything/datasource/jwt';
|
||||
|
||||
/** Operate the user configuration at the workspace level */
|
||||
export class UserConfig extends ServiceBaseClass {
|
||||
@@ -122,4 +123,20 @@ export class UserConfig extends ServiceBaseClass {
|
||||
const workspaceDbBlock = await this.getWorkspaceDbBlock(workspace);
|
||||
workspaceDbBlock.setDecoration(WORKSPACE_CONFIG, workspaceName);
|
||||
}
|
||||
|
||||
async getRecentEditedPages(workspace: string) {
|
||||
const db = await this.database.getDatabase(workspace);
|
||||
const recentEditedPages =
|
||||
(await db.queryBlocks({
|
||||
$sort: 'lastUpdated',
|
||||
$desc: false /* sort rule: true(default)(ASC), or false(DESC) */,
|
||||
$limit: 4,
|
||||
flavor: 'page',
|
||||
} as QueryIndexMetadata)) || [];
|
||||
|
||||
return recentEditedPages.map(item => {
|
||||
item['title'] = item.content || 'Untitled';
|
||||
return item;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user