Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash items with group id #87

Merged
merged 2 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/routes/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const load = (async ({ locals }) => {
return {
me,
users,
luciaUser: user
luciaUser: user,
groupId: activeMembership.groupId
};
}) satisfies PageServerLoad;
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

const hasNewItems = async (user: PageUserData) => {
if (user.items.length === 0) return false;
const userHash = await hash(user.id);
const userHash = await hash(user.id + data.groupId);
const currentHash = await hashItems(user.items);
const viewedHash = $viewedItems[userHash];
return currentHash !== viewedHash;
Expand Down
3 changes: 2 additions & 1 deletion src/routes/wishlists/[username]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export const load: PageServerLoad = async ({ locals, params, depends, url }) =>
items: wishlistItems.filter((item) => item.approved),
approvals: wishlistItems.filter((item) => !item.approved),
suggestionsEnabled: config.suggestions.enable,
showClaimedName: config.claims.showName
showClaimedName: config.claims.showName,
groupId: activeMembership.groupId
};
};
2 changes: 1 addition & 1 deletion src/routes/wishlists/[username]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
};

onMount(async () => {
const userHash = await hash(data.listOwner.id);
const userHash = await hash(data.listOwner.id + data.groupId);
$viewedItems[userHash] = await hashItems(data.items);
pollUpdate();
});
Expand Down
Loading