Skip to content

Commit

Permalink
control joining based on lock gate
Browse files Browse the repository at this point in the history
  • Loading branch information
julianjelfs committed Jul 24, 2024
1 parent 47fc66f commit 119b0ea
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
22 changes: 11 additions & 11 deletions frontend/app/src/components/home/ChatSummary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,17 @@
</MenuItem>
{/if}
{/if}
<MenuItem
disabled={unreadMessages === 0}
on:click={() => client.markAllRead(chatSummary)}>
<CheckboxMultipleMarked
size={$iconSize}
color={"var(--icon-inverted-txt)"}
slot="icon" />
<div slot="text">
<Translatable resourceKey={i18nKey("markAllRead")} />
</div>
</MenuItem>
{#if chatSummary.membership.archived}
<MenuItem on:click={selectChat}>
<ArchiveOffIcon
Expand Down Expand Up @@ -554,17 +565,6 @@
</div>
</MenuItem>
{/if}
<MenuItem
disabled={unreadMessages === 0}
on:click={() => client.markAllRead(chatSummary)}>
<CheckboxMultipleMarked
size={$iconSize}
color={"var(--icon-inverted-txt)"}
slot="icon" />
<div slot="text">
<Translatable resourceKey={i18nKey("markAllRead")} />
</div>
</MenuItem>
</Menu>
</div>
</MenuIcon>
Expand Down
8 changes: 6 additions & 2 deletions frontend/app/src/components/home/NoChatSelected.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
$: chatListScope = client.chatListScope;
$: selectedCommunity = client.selectedCommunity;
$: previewingCommunity = $selectedCommunity?.membership.role === "none";
$: locked = $selectedCommunity?.gate?.kind === "locked_gate";
$: [title, message] = getMessageForScope($chatListScope.kind);
Expand Down Expand Up @@ -58,9 +59,12 @@
<div class="join">
<Button
loading={joiningCommunity}
disabled={joiningCommunity}
disabled={locked || joiningCommunity}
on:click={joinCommunity}
><Translatable resourceKey={i18nKey("communities.joinCommunity")} /></Button>
><Translatable
resourceKey={locked
? i18nKey("access.lockedGate", undefined, "community", true)
: i18nKey("communities.joinCommunity")} /></Button>
<Button secondary small on:click={cancelPreview}>
<Translatable resourceKey={i18nKey("leave")} />
</Button>
Expand Down
8 changes: 6 additions & 2 deletions frontend/app/src/components/home/RecommendedGroup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
$: chatListScope = client.chatListScope;
$: chatSummariesStore = client.chatSummariesStore;
$: member = $chatSummariesStore.has(group.id);
$: locked = group.gate.kind === "locked_gate";
function dismiss({ id }: GroupChatSummary) {
dispatch("dismissRecommendation", id);
Expand Down Expand Up @@ -90,12 +91,15 @@
{:else}
{#if !$suspendedUser}
<Button
disabled={joining === group}
disabled={locked || joining === group}
loading={joining === group}
tiny
hollow
on:click={() => joinGroup(group)}
><Translatable resourceKey={i18nKey("join")} /></Button>
><Translatable
resourceKey={locked
? i18nKey("access.lockedGate", undefined, group.level, true)
: i18nKey("join")} /></Button>
{/if}
<Button disabled={joining === group} tiny on:click={() => gotoGroup(group)}
><Translatable resourceKey={i18nKey("preview")} /></Button>
Expand Down

0 comments on commit 119b0ea

Please sign in to comment.