增加回复与待审提醒:站内消息与 SMTP 邮件通知。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-06 00:34:16 +08:00
parent 322ac14055
commit c05cc472cf
12 changed files with 608 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ import { Skeleton } from '@/components/ui/skeleton';
import type { PostItem, RecentComment, TagCount, User } from '../api/types';
import type { PostHeading } from '../utils/postHeadings';
import { useSiteBranding } from '../hooks/useSiteBranding';
import { formatShortDateTime } from '../utils/content';
import TagCloud from './TagCloud';
import UserLink from './UserLink';
import ArticleOutline from './ArticleOutline';
@@ -213,7 +214,7 @@ export default function RightPanel({
onClick={() => onPostClick(item.post_id, item.floor > 0 ? { floor: item.floor } : undefined)}
>
<span className="widget-item-title">{item.excerpt}</span>
<span className="widget-item-time">{item.created_at}</span>
<span className="widget-item-time">{formatShortDateTime(item.created_at)}</span>
</button>
</div>
))}

View File

@@ -19,6 +19,8 @@ function kindLabel(kind: string) {
switch (kind) {
case 'reject': return '拒帖通知';
case 'report_result': return '举报结果';
case 'reply': return '回复提醒';
case 'moderation': return '待审提醒';
case 'system': return '系统通知';
default: return '';
}

View File

@@ -43,6 +43,14 @@ export function formatDateTime(iso: string) {
return `${d.getFullYear()}${d.getMonth() + 1}${d.getDate()}${pad(d.getHours())}:${pad(d.getMinutes())}`;
}
/** 短日期时间本地时区MM-DD HH:mm用于右栏最新评论等 */
export function formatShortDateTime(iso: string) {
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return iso;
const pad = (n: number) => String(n).padStart(2, '0');
return `${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
}
/** 判断两个 ISO 时间是否相差超过 1 分钟 */
export function isTimeDiffSignificant(a: string, b: string) {
const da = new Date(a).getTime();