feat: v0.1.1 - poll editing, notifications, fixes
- Poll editing by creator (title, options, deadline) - Notification panel with app notifications and click-to-navigate - Poll creation notifies group members - Invitation rejection notifies inviter - Fix: notification createRule, timezone, autocancel, nginx, tab timing Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -111,6 +111,27 @@ export async function respondInvitation(
|
||||
|
||||
// 更新邀请状态
|
||||
await pb.collection('invitations').update(invitationId, updateData)
|
||||
|
||||
// 通知邀请发起人
|
||||
try {
|
||||
const invitation = await pb.collection('invitations').getOne(invitationId, {
|
||||
expand: 'teamSession',
|
||||
$autoCancel: false,
|
||||
}) as any
|
||||
const { createNotification } = await import('./notifications')
|
||||
await createNotification({
|
||||
user: invitation.from,
|
||||
type: response === 'rejected' ? 'team_invite' : 'team_invite',
|
||||
title: response === 'rejected' ? '邀请被拒绝' : '邀请已接受',
|
||||
content: response === 'rejected'
|
||||
? (rejectReason || '对方拒绝了组队邀请')
|
||||
: '对方已接受组队邀请',
|
||||
relatedId: invitation.teamSession,
|
||||
relatedType: 'team',
|
||||
})
|
||||
} catch {
|
||||
// 通知失败不影响主流程
|
||||
}
|
||||
}
|
||||
|
||||
// 订阅邀请变更
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { pb } from './pocketbase'
|
||||
import { awardPoints, deductPoints } from './points'
|
||||
import { createNotification } from './notifications'
|
||||
import type { Poll, PollOption, PollVote } from '@/types'
|
||||
|
||||
export async function createPoll(data: {
|
||||
@@ -33,6 +34,27 @@ export async function createPoll(data: {
|
||||
})
|
||||
}
|
||||
|
||||
// 给同群组其他成员发送通知
|
||||
try {
|
||||
const group = await pb.collection('groups').getOne(data.group)
|
||||
const typeLabel = data.type === 'rollcall' ? '接龙报名' : '投票'
|
||||
const otherMembers = (group.members || []).filter((id: string) => id !== user.id)
|
||||
await Promise.all(
|
||||
otherMembers.map((memberId: string) =>
|
||||
createNotification({
|
||||
user: memberId,
|
||||
type: 'poll_new',
|
||||
title: `新${typeLabel}`,
|
||||
content: `${data.title}`,
|
||||
relatedId: poll.id,
|
||||
relatedType: 'poll',
|
||||
})
|
||||
)
|
||||
)
|
||||
} catch {
|
||||
// 通知发送失败不影响主流程
|
||||
}
|
||||
|
||||
return poll as unknown as Poll
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user