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

fix(groups): group user list #810

Merged
merged 8 commits into from
Nov 6, 2024
Merged
Changes from 2 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
18 changes: 14 additions & 4 deletions src/lib/components/group/ViewMembers.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
let friends: User[] = [] // Initialize friends as an empty array

function update_members(user: User) {
Flemmli97 marked this conversation as resolved.
Show resolved Hide resolved
if (user.key === activeChat.creator) {
Store.addToastNotification(new ToastMessage("", `You can not remove the group creator`, 2))
Flemmli97 marked this conversation as resolved.
Show resolved Hide resolved
members = members
return
}
if (members.length < 3) {
Store.addToastNotification(new ToastMessage("", `A group can not exist with one person`, 2))
Flemmli97 marked this conversation as resolved.
Show resolved Hide resolved
members = members
return
}
let group_members = [...members]
Flemmli97 marked this conversation as resolved.
Show resolved Hide resolved

if (group_members.includes(user)) {
Expand All @@ -34,14 +44,14 @@
}

function remove_member(user: User) {
Flemmli97 marked this conversation as resolved.
Show resolved Hide resolved
if (members.length < 3) {
Store.addToastNotification(new ToastMessage("", `A group can not exist with one person`, 2))
return
}
if (user.key === activeChat.creator) {
Store.addToastNotification(new ToastMessage("", `You can not remove the group creator`, 2))
Flemmli97 marked this conversation as resolved.
Show resolved Hide resolved
return
}
if (members.length < 3) {
Store.addToastNotification(new ToastMessage("", `A group can not exist with one person`, 2))
Flemmli97 marked this conversation as resolved.
Show resolved Hide resolved
return
}

let group_members = [...members]

Expand Down