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: disable platform profiles and enable message delete #1182

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage-website",
"version": "0.2.13",
"version": "0.2.14",
"license": "GPL-3.0",
"private": true,
"type": "module",
Expand Down
1 change: 0 additions & 1 deletion src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const handle = onHandle(async ({ event, resolve }) => {
maxAge: 60 * 60 * 24 * 30
})
}
//TODO: if need to update platform object, visit app.d.ts file
event.locals = {
user: {
userId: parseInt(userId),
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/Channel/Chat/DrawerRestream.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@
urlList.some((item) => item.platform === 'twitch')}
><IconSocialTwitch /> Twitch
</button>
<!-- <button
<button
class="btn btn-sm"
on:click={linkYoutube}
disabled={urlList &&
Array.isArray(urlList) &&
urlList.some((item) => item.platform === 'youtube')}
><IconSocialYouTube /> YouTube</button> -->
><IconSocialYouTube /> YouTube</button>
</div>
<label class="label">
<span class="label-text">Name</span>
Expand Down
44 changes: 22 additions & 22 deletions src/lib/components/Channel/Chat/Message.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
onMount(() => {
const spans = document.querySelectorAll('span[name="username"]')
spans.forEach((span: any) => {
span.onclick = sender.platform ?? onUsernameClick
span.onclick = onUsernameClick
})
})

Expand All @@ -159,18 +159,16 @@
<div class="relative m-1">
<!--Host, Mod, You or Rando-->
<div class="border border-transparent rounded-lg gap-2 flex">
{#if !sender.platform}
<div
class="group-hover:block dropdown-menu absolute hidden right-0 dropdown dropdown-left dropdown-end"
tabindex="1">
<div class="rounded-lg bg-base-300 absolute bottom-0 right-0 border-base-100 border-2">
<IconChatHorizontalMore />
</div>
<ul
tabindex="1"
class="dropdown-content menu p-2 shadow bg-base-200 rounded-box w-52 z-10">
<li class="disabled"><a><IconChatReact /> React </a></li>
<li class="disabled"><a><IconChatQuote /> Quote </a></li>
<div
class="group-hover:block dropdown-menu absolute hidden right-0 dropdown dropdown-left dropdown-end"
tabindex="1">
<div class="rounded-lg bg-base-300 absolute bottom-0 right-0 border-base-100 border-2">
<IconChatHorizontalMore />
</div>
<ul tabindex="1" class="dropdown-content menu p-2 shadow bg-base-200 rounded-box w-52 z-10">
<li class="disabled"><a><IconChatReact /> React </a></li>
<li class="disabled"><a><IconChatQuote /> Quote </a></li>
{#if !sender.platform}
{#if showRoleItem && !channel.bans.includes(sender.user?.userId)}
<li>
<a on:click={() => toggleMod()}
Expand All @@ -190,14 +188,14 @@
</a>
</li>
{/if}
{#if hostId === $page.data.user?.userId || sender.user?.userId === $page.data.user?.userId}
<li>
<a on:click={() => deleteMessage()}><IconChatDelete /> Delete</a>
</li>
{/if}
</ul>
</div>
{/if}
{/if}
{#if hostId === $page.data.user?.userId || sender.user?.userId === $page.data.user?.userId}
<li>
<a on:click={() => deleteMessage()}><IconChatDelete /> Delete</a>
</li>
{/if}
</ul>
</div>
<div class="d-flex align-items-center">
{#if sender.platform === 'twitch'}
<div style="display: ruby;"><IconSocialTwitch /></div>
Expand All @@ -212,7 +210,9 @@
{#if role !== '🤖 AI'}
<span
class="{coloredRole.textColor} font-medium cursor-pointer"
on:click={onUsernameClick}
on:click={() => {
if (!sender.platform) onUsernameClick()
}}
id={'@' + sender.user?.username}>
@{sender.user?.username}
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/channel/[channelId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
message: {
isAiChatEnabled: false,
body: item.message,
platform: 'youtube',
platform: item.platform,
youtubeMessageId: item.id
}
})
Expand Down
Loading