diff --git a/src/client/components/feed/FeedArchivePageButton.tsx b/src/client/components/feed/FeedArchivePageButton.tsx index 149d171..50f8131 100644 --- a/src/client/components/feed/FeedArchivePageButton.tsx +++ b/src/client/components/feed/FeedArchivePageButton.tsx @@ -110,7 +110,7 @@ export const FeedArchivePageButton: React.FC = + <> + {item.url && ( + + )} + + + } /> )} diff --git a/src/server/model/feed/event.ts b/src/server/model/feed/event.ts index 43433a4..3b599ef 100644 --- a/src/server/model/feed/event.ts +++ b/src/server/model/feed/event.ts @@ -12,6 +12,7 @@ import { } from '../../prisma/zod/index.js'; import dayjs from 'dayjs'; import { z } from 'zod'; +import { compact } from 'lodash-es'; const { get: getFeedEventNotify, del: delFeedEventNotifyCache } = buildQueryWithCache(async (channelId: string) => { @@ -80,9 +81,12 @@ export async function sendFeedEventsNotify( const eventTokens: ContentToken[] = [ token.list( events.map((event) => - token.text( - `[${event.source}:${event.eventName}] ${event.senderName ?? ''}: ${event.eventContent}` - ) + compact([ + token.text( + `[${event.source}:${event.eventName}] ${event.senderName ?? ''}: ${event.eventContent}` + ), + event.url && token.url(event.url, '[→]'), + ]) ) ), ]; diff --git a/src/server/model/notification/token/index.ts b/src/server/model/notification/token/index.ts index 4d6985d..4bfbee2 100644 --- a/src/server/model/notification/token/index.ts +++ b/src/server/model/notification/token/index.ts @@ -41,7 +41,7 @@ export const token = { url, title, }), - list: (items: ContentToken[]): ListContentToken => ({ + list: (items: ContentToken[][]): ListContentToken => ({ type: 'list', items, }), diff --git a/src/server/model/notification/token/tokenizer/base.ts b/src/server/model/notification/token/tokenizer/base.ts index 39ba98b..2de15f1 100644 --- a/src/server/model/notification/token/tokenizer/base.ts +++ b/src/server/model/notification/token/tokenizer/base.ts @@ -35,7 +35,7 @@ export class BaseContentTokenizer { } parseList(token: ListContentToken) { - return token.items.map((item) => this.parse([item])).join('\n'); + return token.items.map((tokens) => this.parse(tokens)).join('\n'); } parse(tokens: ContentToken[]): string { diff --git a/src/server/model/notification/token/tokenizer/html.ts b/src/server/model/notification/token/tokenizer/html.ts index cee3225..9af1a5b 100644 --- a/src/server/model/notification/token/tokenizer/html.ts +++ b/src/server/model/notification/token/tokenizer/html.ts @@ -40,6 +40,6 @@ export class HTMLContentTokenizer extends BaseContentTokenizer { } parseList(token: ListContentToken) { - return ``; + return ``; } } diff --git a/src/server/model/notification/token/tokenizer/markdown.ts b/src/server/model/notification/token/tokenizer/markdown.ts index 316aeaa..768bd07 100644 --- a/src/server/model/notification/token/tokenizer/markdown.ts +++ b/src/server/model/notification/token/tokenizer/markdown.ts @@ -37,7 +37,7 @@ export class MarkdownContentTokenizer extends BaseContentTokenizer { parseList(token: ListContentToken) { return ( '\n' + - token.items.map((item) => `- ${this.parse([item])}`).join('\n') + + token.items.map((tokens) => `- ${this.parse(tokens)}`).join('\n') + '\n' ); } diff --git a/src/server/model/notification/token/type.ts b/src/server/model/notification/token/type.ts index 8f6d74e..7d462bc 100644 --- a/src/server/model/notification/token/type.ts +++ b/src/server/model/notification/token/type.ts @@ -31,7 +31,7 @@ export type UrlContentToken = { export type ListContentToken = { type: 'list'; - items: ContentToken[]; + items: ContentToken[][]; }; export type ContentToken =