bug fixed

This commit is contained in:
daniel31x13 2024-07-18 10:46:21 -04:00
parent 6c29d905d9
commit 92c7f40956
2 changed files with 4 additions and 12 deletions

View File

@ -177,7 +177,7 @@ export default function LinkMasonry({ link, flipDropdown, editMode }: Props) {
</p> </p>
)} )}
{link.tags[0] && ( {link.tags && link.tags[0] && (
<div className="flex gap-1 items-center flex-wrap"> <div className="flex gap-1 items-center flex-wrap">
{link.tags.map((e, i) => ( {link.tags.map((e, i) => (
<Link <Link
@ -225,7 +225,7 @@ export default function LinkMasonry({ link, flipDropdown, editMode }: Props) {
</span> </span>
)} )}
</p> </p>
{link.tags[0] && ( {link.tags && link.tags[0] && (
<> <>
<p className="text-neutral text-lg mt-3 font-semibold"> <p className="text-neutral text-lg mt-3 font-semibold">
{t("tags")} {t("tags")}

View File

@ -48,7 +48,7 @@ export default async function updateLinkById(
}, },
}); });
return { response: updatedLink, status: 200 }; // return { response: updatedLink, status: 200 };
} }
const targetCollectionIsAccessible = await getPermission({ const targetCollectionIsAccessible = await getPermission({
@ -60,9 +60,6 @@ export default async function updateLinkById(
(e: UsersAndCollections) => e.userId === userId && e.canUpdate (e: UsersAndCollections) => e.userId === userId && e.canUpdate
); );
const targetCollectionsAccessible =
targetCollectionIsAccessible?.ownerId === userId;
const targetCollectionMatchesData = data.collection.id const targetCollectionMatchesData = data.collection.id
? data.collection.id === targetCollectionIsAccessible?.id ? data.collection.id === targetCollectionIsAccessible?.id
: true && data.collection.name : true && data.collection.name
@ -71,12 +68,7 @@ export default async function updateLinkById(
? data.collection.ownerId === targetCollectionIsAccessible?.ownerId ? data.collection.ownerId === targetCollectionIsAccessible?.ownerId
: true; : true;
if (!targetCollectionsAccessible) if (!targetCollectionMatchesData)
return {
response: "Target collection is not accessible.",
status: 401,
};
else if (!targetCollectionMatchesData)
return { return {
response: "Target collection does not match the data.", response: "Target collection does not match the data.",
status: 401, status: 401,