Polish milestone dialog and one-time delivery
This commit is contained in:
@@ -16,8 +16,9 @@ async function ownedMilestone(id: string, userId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function clientState(milestone: { brandStatus: string; brandPostUrl: string | null; brandPostError: string | null; selfSharedAt: Date | null }) {
|
||||
function clientState(milestone: { status: string; brandStatus: string; brandPostUrl: string | null; brandPostError: string | null; selfSharedAt: Date | null }) {
|
||||
return {
|
||||
promptStatus: milestone.status,
|
||||
brandStatus: milestone.brandStatus,
|
||||
brandPostUrl: milestone.brandPostUrl,
|
||||
brandPostError: milestone.brandPostError,
|
||||
@@ -86,7 +87,10 @@ export async function PATCH(request: NextRequest, { params }: { params: { id: st
|
||||
// much less disruptive in an X compose window than a full UUID.
|
||||
const updated = await db.socialMilestone.update({
|
||||
where: { id: milestone.id },
|
||||
data: { selfSharedAt: now, publicShareApprovedAt: now, shareToken: token, cardData: card, language },
|
||||
data: {
|
||||
status: 'self_shared', respondedAt: milestone.respondedAt || now,
|
||||
selfSharedAt: now, publicShareApprovedAt: now, shareToken: token, cardData: card, language,
|
||||
},
|
||||
});
|
||||
return NextResponse.json({ ok: true, shareToken: token, shareUrl, shareVersion: now.getTime(), milestone: clientState(updated) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user