hotfix: notifications do not understand reactions
This commit is contained in:
parent
f5676f5b7a
commit
22feedaff5
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import * as api from '$lib/client/api.js';
|
import * as api from '$lib/client/api.js';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
import ReplyIcon from '$lib/../img/icons/reply.svg';
|
import ReplyIcon from '$lib/../img/icons/reply.svg';
|
||||||
import RepostIcon from '$lib/../img/icons/repost.svg';
|
import RepostIcon from '$lib/../img/icons/repost.svg';
|
||||||
|
@ -22,6 +23,8 @@
|
||||||
return `%1 mentioned you.`;
|
return `%1 mentioned you.`;
|
||||||
case "reblog":
|
case "reblog":
|
||||||
return `%1 boosted your post.`;
|
return `%1 boosted your post.`;
|
||||||
|
case "reaction":
|
||||||
|
return `%1 reacted to your post.`;
|
||||||
case "follow":
|
case "follow":
|
||||||
return `%1 followed you.`;
|
return `%1 followed you.`;
|
||||||
case "follow_request":
|
case "follow_request":
|
||||||
|
@ -39,6 +42,20 @@
|
||||||
|
|
||||||
let account = data.accounts[0];
|
let account = data.accounts[0];
|
||||||
$: accounts_short = data.accounts.slice(0, 3).reverse();
|
$: accounts_short = data.accounts.slice(0, 3).reverse();
|
||||||
|
|
||||||
|
let mouse_pos = { top: 0, left: 0 };
|
||||||
|
|
||||||
|
function gotoPost(event) {
|
||||||
|
if (!data.status) return;
|
||||||
|
if (event) {
|
||||||
|
if (event.type == "mouseup" && (
|
||||||
|
event.button !== 0 ||
|
||||||
|
event.shiftKey ||
|
||||||
|
event.ctrlKey)) return;
|
||||||
|
if (event.key && event.key !== "Enter") return;
|
||||||
|
}
|
||||||
|
goto(`/post/${data.status.id}`);
|
||||||
|
}
|
||||||
|
|
||||||
let aria_label = function () {
|
let aria_label = function () {
|
||||||
if (accounts.length == 1)
|
if (accounts.length == 1)
|
||||||
|
@ -48,14 +65,19 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a class="notification" href={data.status ? `/post/${data.status.id}` : null} aria-label={aria_label}>
|
<article
|
||||||
|
class="notification"
|
||||||
|
aria-label={aria_label}
|
||||||
|
on:mousedown={e => {mouse_pos.left = e.pageX; mouse_pos.top = e.pageY}}
|
||||||
|
on:mouseup={e => {if (e.pageX == mouse_pos.left && e.pageY == mouse_pos.top) gotoPost(e)}}
|
||||||
|
on:keydown={gotoPost}>
|
||||||
<header aria-hidden>
|
<header aria-hidden>
|
||||||
<span class="notif-icon">
|
<span class="notif-icon">
|
||||||
{#if data.type === "favourite"}
|
{#if data.type === "favourite"}
|
||||||
<FavouriteIcon />
|
<FavouriteIcon />
|
||||||
{:else if data.type === "reblog"}
|
{:else if data.type === "reblog"}
|
||||||
<RepostIcon />
|
<RepostIcon />
|
||||||
{:else if data.type === "react"}
|
{:else if data.type === "reaction"}
|
||||||
<ReactIcon />
|
<ReactIcon />
|
||||||
{:else if data.type === "mention"}
|
{:else if data.type === "mention"}
|
||||||
<ReplyIcon />
|
<ReplyIcon />
|
||||||
|
@ -88,7 +110,7 @@
|
||||||
<ActionBar post={data.status} />
|
<ActionBar post={data.status} />
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</a>
|
</article>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.notification {
|
.notification {
|
||||||
|
|
Loading…
Reference in a new issue