feat: public shopping list links can allow editing
Owner opts in per-list via a new "Allow editing" toggle next to the existing public-link switch. Anonymous writes are scoped to that one list only — the link id is the sole credential, enforced in getShoppingListAccess and the item routes (no session required there now), with an IP rate limit on genuinely anonymous requests. Turning off the public link also revokes editing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,10 @@ async function getOtherRecipients(listId: string, actorId: string) {
|
||||
export async function notifyShoppingListMembers(
|
||||
listId: string,
|
||||
actorId: string,
|
||||
actorName: string,
|
||||
// null actorName = an anonymous edit via a public-editable share link — no
|
||||
// per-visitor identity exists, so this is rendered as a localized generic
|
||||
// label (per recipient's own locale) rather than a real name.
|
||||
actorName: string | null,
|
||||
event: { type: "checked" | "itemsAdded"; itemName?: string; count?: number; listName: string }
|
||||
): Promise<void> {
|
||||
const recipients = await getOtherRecipients(listId, actorId);
|
||||
@@ -57,16 +60,17 @@ export async function notifyShoppingListMembers(
|
||||
if (!(await isNotificationCategoryEnabled(recipient.id, "shoppingList"))) return;
|
||||
|
||||
const messages = getMessages(recipient.locale);
|
||||
const displayName = actorName ?? messages.publicShoppingList.anonymousEditor;
|
||||
const title = messages.notifications.pushTitle.shoppingListUpdate;
|
||||
const body =
|
||||
event.type === "checked"
|
||||
? formatMessage(messages.notifications.detail.shoppingListChecked, {
|
||||
name: actorName,
|
||||
name: displayName,
|
||||
item: event.itemName ?? "",
|
||||
list: event.listName,
|
||||
})
|
||||
: formatMessage(messages.notifications.detail.shoppingListItemsAdded, {
|
||||
name: actorName,
|
||||
name: displayName,
|
||||
countLabel: itemsCountLabel(event.count ?? 1, recipient.locale),
|
||||
list: event.listName,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user