fix editing group members from group page

This commit is contained in:
Fulmine 2022-03-20 07:53:56 +01:00
parent bf678cc757
commit 3519cec34f
4 changed files with 6 additions and 5 deletions

View File

@ -117,6 +117,6 @@
{:else if editMode} {:else if editMode}
<Edit on:deletion on:update bind:group bind:editMode /> <Edit on:deletion on:update bind:group bind:editMode />
{:else if memberMode} {:else if memberMode}
<MemberEdit on:update bind:group bind:memberMode bind:members /> <MemberEdit on:updateMembers bind:group bind:memberMode bind:members />
{/if} {/if}
</CardBody> </CardBody>

View File

@ -294,14 +294,14 @@
<CardsHeader bind:item={group} slot="header"> <CardsHeader bind:item={group} slot="header">
<FaUsers slot="icon" /> <FaUsers slot="icon" />
</CardsHeader> </CardsHeader>
<Body on:deletion={updateDelete} on:update={updateList} bind:members bind:group bind:isPublic={isPublic}/> <Body on:deletion={updateDelete} on:update={updateList} on:updateMembers={updateList} bind:members bind:group bind:isPublic={isPublic}/>
</AccordionItem> </AccordionItem>
{:else} {:else}
<AccordionItem> <AccordionItem>
<CardsHeader bind:item={group} slot="header"> <CardsHeader bind:item={group} slot="header">
<FaLock slot="icon" /> <FaLock slot="icon" />
</CardsHeader> </CardsHeader>
<Body on:deletion={updateDelete} on:update={updateList} bind:members bind:group bind:isPublic={isPublic}/> <Body on:deletion={updateDelete} on:update={updateList} on:updateMembers={updateList} bind:members bind:group bind:isPublic={isPublic}/>
</AccordionItem> </AccordionItem>
{/if} {/if}
{/each} {/each}

View File

@ -65,7 +65,7 @@ function memberListRenderer(item: any) {
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
function update() { function update() {
dispatch("update", group) dispatch("updateMembers", group)
} }
async function submitAdd() { async function submitAdd() {

View File

@ -65,6 +65,7 @@
async function fetchMembers() { async function fetchMembers() {
try { try {
members = await api().groups($params.id).members().get({auth: !isPublic}); members = await api().groups($params.id).members().get({auth: !isPublic});
group.members = members.map(function(member) {return member.uuid});
if (!isPublic) { if (!isPublic) {
await new Promise(resolve => setTimeout(resolve, 1000)); await new Promise(resolve => setTimeout(resolve, 1000));
systemMembers = await api().systems("@me").members.get({ auth: true }); systemMembers = await api().systems("@me").members.get({ auth: true });
@ -134,7 +135,7 @@
</CardsHeader> </CardsHeader>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
<Body on:deletion={updateDelete} on:updateGroups={updateMembers} bind:members={systemMembers} bind:group={group} isPage={isPage} isPublic={isPublic}/> <Body on:deletion={updateDelete} on:updateMembers={updateMembers} bind:members={systemMembers} bind:group={group} isPage={isPage} isPublic={isPublic}/>
</CardBody> </CardBody>
</Card> </Card>
{/if} {/if}