Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

bug fixed

daniel31x139486d699c9ba
diff --git a/components/Modal/Collection/TeamManagement.tsx b/components/Modal/Collection/TeamManagement.tsx
index 07854aae..68a2a811 100644
--- a/components/Modal/Collection/TeamManagement.tsx
+++ b/components/Modal/Collection/TeamManagement.tsx
@@ -40,15 +40,7 @@ export default function TeamManagement({
const publicCollectionURL = `${currentURL.origin}/public/collections/${collection.id}`;
- const [member, setMember] = useState<Member>({
- canCreate: false,
- canUpdate: false,
- canDelete: false,
- user: {
- name: "",
- username: "",
- },
- });
+ const [memberUsername, setMemberUsername] = useState("");
const [collectionOwner, setCollectionOwner] = useState({
id: null,
@@ -77,15 +69,7 @@ export default function TeamManagement({
members: [...collection.members, newMember],
});
- setMember({
- canCreate: false,
- canUpdate: false,
- canDelete: false,
- user: {
- name: "",
- username: "",
- },
- });
+ setMemberUsername("");
};
const [submitLoader, setSubmitLoader] = useState(false);
@@ -168,19 +152,14 @@ export default function TeamManagement({
<div className="flex items-center gap-2">
<TextInput
- value={member.user.username || ""}
+ value={memberUsername || ""}
placeholder="Username (without the '@')"
- onChange={(e) => {
- setMember({
- ...member,
- user: { ...member.user, username: e.target.value },
- });
- }}
+ onChange={(e) => setMemberUsername(e.target.value)}
onKeyDown={(e) =>
e.key === "Enter" &&
addMemberToCollection(
session.data?.user.username as string,
- member.user.username || "",
+ memberUsername || "",
collection,
setMemberState
)
@@ -191,7 +170,7 @@ export default function TeamManagement({
onClick={() =>
addMemberToCollection(
session.data?.user.username as string,
- member.user.username || "",
+ memberUsername || "",
collection,
setMemberState
)
diff --git a/components/ProfilePhoto.tsx b/components/ProfilePhoto.tsx
index 7dcb02c8..a96e8baa 100644
--- a/components/ProfilePhoto.tsx
+++ b/components/ProfilePhoto.tsx
@@ -14,7 +14,6 @@ export default function ProfilePhoto({ src, className, priority }: Props) {
const [image, setImage] = useState("");
useEffect(() => {
- console.log(src);
if (src && !src?.includes("base64"))
setImage(`/api/v1/${src.replace("uploads/", "").replace(".jpg", "")}`);
else if (!src) setImage("");
@@ -36,6 +35,7 @@ export default function ProfilePhoto({ src, className, priority }: Props) {
height={112}
width={112}
priority={priority}
+ draggable={false}
className={`h-10 w-10 bg-sky-600 dark:bg-sky-600 shadow rounded-full aspect-square border border-slate-200 dark:border-neutral-700 ${className}`}
/>
);
diff --git a/lib/api/controllers/collections/collectionId/updateCollectionById.ts b/lib/api/controllers/collections/collectionId/updateCollectionById.ts
index 076bb08b..30bb6012 100644
--- a/lib/api/controllers/collections/collectionId/updateCollectionById.ts
+++ b/lib/api/controllers/collections/collectionId/updateCollectionById.ts
@@ -59,6 +59,7 @@ export default async function updateCollection(
include: {
user: {
select: {
+ image: true,
username: true,
name: true,
id: true,
diff --git a/lib/api/controllers/users/userId/getPublicUserById.ts b/lib/api/controllers/users/userId/getPublicUserById.ts
index 16260432..c5a575e5 100644
--- a/lib/api/controllers/users/userId/getPublicUserById.ts
+++ b/lib/api/controllers/users/userId/getPublicUserById.ts
@@ -40,6 +40,7 @@ export default async function getPublicUserById(
const { password, ...lessSensitiveInfo } = user;
const data = {
+ id: lessSensitiveInfo.id,
name: lessSensitiveInfo.name,
username: lessSensitiveInfo.username,
image: lessSensitiveInfo.image,
diff --git a/lib/client/addMemberToCollection.ts b/lib/client/addMemberToCollection.ts
index 95f32179..8d1e0b12 100644
--- a/lib/client/addMemberToCollection.ts
+++ b/lib/client/addMemberToCollection.ts
@@ -27,10 +27,10 @@ const addMemberToCollection = async (
if (user.username) {
setMember({
collectionId: collection.id,
- userId: user.id,
canCreate: false,
canUpdate: false,
canDelete: false,
+ userId: user.id,
user: {
id: user.id,
name: user.name,
diff --git a/lib/client/getPublicUserData.ts b/lib/client/getPublicUserData.ts
index 6b3706ec..20bd1e93 100644
--- a/lib/client/getPublicUserData.ts
+++ b/lib/client/getPublicUserData.ts
@@ -5,8 +5,6 @@ export default async function getPublicUserData(id: number | string) {
const data = await response.json();
- console.log(data);
-
if (!response.ok) toast.error(data.response);
return data.response;
diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx
index f1751aaf..320e0316 100644
--- a/pages/collections/[id].tsx
+++ b/pages/collections/[id].tsx
@@ -105,7 +105,7 @@ export default function Index() {
<ProfilePhoto
key={i}
src={e.user.image ? e.user.image : undefined}
- className="-mr-3 border-[3px]"
+ className="border-[3px]"
/>
);
})
diff --git a/pages/settings/account.tsx b/pages/settings/account.tsx
index 8248006f..d7cf248a 100644
--- a/pages/settings/account.tsx
+++ b/pages/settings/account.tsx
@@ -48,7 +48,6 @@ export default function Account() {
}
useEffect(() => {
- console.log(account);
if (!objectIsEmpty(account)) setUser({ ...account });
}, [account]);
diff --git a/types/global.ts b/types/global.ts
index 4944c83c..cfc149b3 100644
--- a/types/global.ts
+++ b/types/global.ts
@@ -18,11 +18,11 @@ export interface LinkIncludingShortenedCollectionAndTags
export interface Member {
collectionId?: number;
- userId?: number;
+ userId: number;
canCreate: boolean;
canUpdate: boolean;
canDelete: boolean;
- user: OptionalExcluding<User, "username" | "name">;
+ user: OptionalExcluding<User, "username" | "name" | "id">;
}
export interface CollectionIncludingMembersAndLinkCount