frontend: hide edit buttons for channels and messages if the user can't edit them
This commit is contained in:
parent
21b06c38d2
commit
fb9fccb038
2 changed files with 12 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { MoreVerticalIcon } from "svelte-feather-icons";
|
||||
import { overlayStore } from "../stores";
|
||||
import { overlayStore, userInfoStore } from "../stores";
|
||||
|
||||
export let message;
|
||||
</script>
|
||||
|
@ -49,7 +49,9 @@
|
|||
<div class="message">
|
||||
<span class="author">{ message.author_username }</span>
|
||||
<span class="message-content" class:pending={ message._isPending }>{ message.content }</span>
|
||||
<button class="icon-button icon-button-auto edit-message" on:click="{ () => overlayStore.open('editMessage', { message }) }">
|
||||
<MoreVerticalIcon />
|
||||
</button>
|
||||
{#if $userInfoStore && message.author_id === $userInfoStore.id}
|
||||
<button class="icon-button icon-button-auto edit-message" on:click="{ () => overlayStore.open('editMessage', { message }) }">
|
||||
<MoreVerticalIcon />
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { HashIcon, PlusIcon, MoreVerticalIcon } from "svelte-feather-icons";
|
||||
import { quadInOut } from "svelte/easing";
|
||||
import { fly } from "svelte/transition";
|
||||
import { channels, overlayStore, selectedChannel, showChannelView, showSidebar, smallViewport } from "../stores";
|
||||
import { channels, overlayStore, selectedChannel, showChannelView, showSidebar, smallViewport, userInfoStore } from "../stores";
|
||||
import UserTopBar from "./UserTopBar.svelte";
|
||||
|
||||
let pendingSelectChannel = null;
|
||||
|
@ -40,9 +40,11 @@
|
|||
<HashIcon />
|
||||
</div>
|
||||
<span>{ channel.name }</span>
|
||||
<button class="icon-button icon-button-auto" on:click|stopPropagation="{ () => overlayStore.open('editChannel', { channel }) }">
|
||||
<MoreVerticalIcon />
|
||||
</button>
|
||||
{#if $userInfoStore && channel.owner_id === $userInfoStore.id}
|
||||
<button class="icon-button icon-button-auto" on:click|stopPropagation="{ () => overlayStore.open('editChannel', { channel }) }">
|
||||
<MoreVerticalIcon />
|
||||
</button>
|
||||
{/if}
|
||||
</button>
|
||||
{/each}
|
||||
<button on:click="{ () => overlayStore.open('createChannel') }" class="sidebar-button">
|
||||
|
|
Loading…
Reference in a new issue